WELLINGTON, New Zealand — New Zealand Prime Minister Jacinda Ardern, who became a global icon of the left and exemplified a new style of leadership, said Thursday that she would leave office.

Just 37 when she became leader, Ardern was praised around the world for her handling of the nation’s worst-ever mass shooting and the early stages of the coronavirus pandemic. But she faced mounting political pressures at home and a level of vitriol from some that hadn’t been experienced by previous New Zealand leaders.

Still, her announcement came as a shock throughout the nation of 5 million people.

Fighting back tears, Ardern told reporters in Napier that Feb. 7 would be her last day as prime minister after five and a half years in office.

“I know what this job takes, and I know that I no longer have enough in the tank to do it justice. It is that simple,” she said.

Lawmakers in her Labour Party will vote for a new leader on Sunday.

Ardern became an inspiration to women around the world after first winning the top job in 2017. She seemed to herald a new generation of leadership — she was on the verge of being a millennial, had spun some records as a part-time DJ, and wasn’t married like most politicians.

In 2018, Ardern became just the second world leader to give birth while holding office

She notched up center-left victories while right-wing populism was on the rise globally, pushing pushed through a bill targeting net-zero carbon emissions by 2050, overseeing a ban on assault weapons, and largely keeping the coronavirus out of New Zealand for 18 months.

Her approach to the pandemic earned the ire of U.S. President Donald Trump, and she pushed back against wildly exaggerated claims from Trump about the spread of COVID-19 after he said there was a massive outbreak and “It’s over for New Zealand. Everything’s gone.”

“Was angry the word?” Ardern said about Trump’s comments in an interview with The Associated Press at the time.

In March 2019, Ardern faced one of the darkest days in New Zealand’s history when a white supremacist gunman stormed two mosques in Christchurch and slaughtered 51 worshippers during Friday prayers. Ardern was widely praised for her empathy with survivors and New Zealand’s wider Muslim community in the aftermath.

After the mosque shootings, Ardern moved within weeks to pass new laws banning the deadliest types of semi-automatic weapons. A subsequent buyback scheme run by police saw more than 50,000 guns, including many AR-15-style rifles, destroyed.

Less than nine months after the shooting, she faced another tragedy when 22 tourists and guides were killed when the White Island volcano erupted.

Ardern was lauded globally for her country’s initial handling of the coronavirus pandemic after New Zealand managed to stop the virus at its borders for months. But she was forced to abandon that zero-tolerance strategy as more contagious variants spread and vaccines became widely available.

She faced growing anger at home from those who opposed coronavirus mandates and rules. A protest against vaccine mandates that began on Parliament’s grounds last year lasted for more than three weeks and ended with protesters hurling rocks at police and setting fires to tents and mattresses as they were forced to leave. This year, Ardern canceled an annual barbecue she hosts due to security fears.

Ardern last month announced a wide-ranging Royal Commission of Inquiry would look into whether the government made the right decisions in battling COVID-19 and how it could better prepare for future pandemics. A report is due next year.

Many observers said that sexist attitudes played a role in the anger directed at Ardern.

“Her treatment, the pile on, in the last few months has been disgraceful and embarrassing,” wrote actor Sam Neill on Twitter. “All the bullies, the misogynists, the aggrieved. She deserved so much better. A great leader.”

But Ardern and her government also faced criticism that it had been big on ideas but lacking on execution. Supporters worried it hadn’t made promised gains on increasing housing supply and reducing child poverty, while opponents said it was not focusing enough on crime and the struggling economy.

Ardern described climate change as the great challenge for her generation. But her polices faced skepticism and opposition, including from farmers who protested plans to tax cow burps and other greenhouse gas emissions.

Ardern had been facing tough prospects at the ballot box. Her center-left Labour Party won reelection in 2020 with a landslide of historic proportions, but recent polls have put her party behind its conservative rivals.

Ardern said the role required having a reserve to face the unexpected.

“But I am not leaving because it was hard. Had that been the case I probably would have departed two months into the job,” she said. “I am leaving because with such a privileged role comes responsibility. The responsibility to know when you are the right person to lead, and also, when you are not.”

She said her time in office had been challenging but fulfilling.

“I am entering now my sixth year in office, and for each of those years, I have given my absolute all,” she said.

Australian Prime Minister Anthony Albanese said Ardern “has shown the world how to lead with intellect and strength.”

“She has demonstrated that empathy and insight are powerful leadership qualities,” Albanese tweeted. “Jacinda has been a fierce advocate for New Zealand, an inspiration to so many and a great friend to me.”

Canadian Prime Minister Justin Trudeau thanked Ardern on Twitter for her friendship and “empathic, compassionate, strong, and steady leadership.”

Ardern charted an independent course for New Zealand. She tried to take a more diplomatic approach to China than neighboring Australia, which had ended up feuding with Beijing. In an interview with the AP last month, she said that building relationships with small Pacific nations shouldn’t become a game of one-upmanship with China.

New Zealand Opposition Leader Christopher Luxon said Ardern had been a strong ambassador for the country on the world stage. He said that for his party “nothing changes” and it remains intent on winning this year’s general elections to “deliver a government that can get things done for the New Zealand people.”

Ardern announced that vote would be held on Oct. 14, and that she would remain a lawmaker until then. Deputy Prime Minister Grant Robertson announced that he won’t contest the leadership of the Labour Party, throwing the competition open.

It’s unclear who will take over as prime minister until the election.

If no candidate gets at least two-thirds support from the caucus when Labour lawmakers vote on Sunday, then the leadership contest will go to the wider party membership. Ardern has recommended the party chose her replacement by the time she steps down.

Ardern said she hadn’t had too much time to reflect on her tenure in the role, although noted it had been marked with crises.

“It’s one thing to lead your country in peace times, it’s another to lead them through crisis. There’s a greater weight of responsibility, a greater vulnerability amongst the people, and so in many ways, I think that will be what sticks with me,” she said. “I had the privilege of being alongside New Zealand during crisis, and they placed their faith in me.”

Aya Al-Umari, whose brother Hussein was killed in the Christchurch mosque attacks, tweeted her “deepest gratitude” to Ardern, saying her compassion and leadership during that grim day “shone a light in our grief journey.”

“I have a mixture of feelings, shocked, sad but really happy for her,” Al-Umari wrote.

Ardern said she didn’t have any immediate plans after leaving office, other than family commitments with her daughter, Neve, and her fiancé, Clarke Gayford, after an outbreak of the virus thwarted their earlier wedding plans.

“And so to Neve, Mum is looking forward to being there when you start school this year,” Ardern said. “And to Clarke, let’s finally get married.”