CHRISTCHURCH, New Zealand — For the first 16 months of her tenure, Jacinda Ardern was feted around an increasingly populist world for being young, female and progressive.

The 37-year-old New Zealand prime minister, together with Justin Trudeau of Canada and France’s Emmanuel Macron, were celebrated by some as the antidote to Donald Trump. Vogue magazine ran a glamorous photo spread of her. She appeared on “The Late Show With Stephen Colbert.” Sheryl Sandberg described her as a “political prodigy” when Ardern made Time magazine’s list of 100 “most influential people.”

A term was coined to describe the phenomenon: “Jacindamania.”

The sentiment only grew when she announced she was pregnant, becoming the second world leader to have a baby in office (Pakistan’s Benazir Bhutto was the first), and it grew again when she took her 3-month-old daughter to the United Nations General Assembly in New York.

At home, however, she has had plenty of political trials and tribulations; her handling of the economy has been criticized, and her efforts to introduce more affordable housing have been plagued by embarrassing bureaucratic blunders. Detractors said she was all style and no substance.

But these domestic problems did not dent the perception of her abroad as an inspirational leader for the modern age.

Now, Jacindamania has taken on a new and totally different dimension in the last few days, since mass shootings at two mosques in Christchurch left 50 dead and 40 injured.

New Zealand has never experienced this kind of attack before, and it has shaken the country.

Many have lauded Ardern’s response. She swiftly labeled the attacks “terrorism” and bluntly called an Australian lawmaker’s suggestion of a link between Muslim immigration and violence “a disgrace.”

“Ardern’s performance has been extraordinary — and I believe she will be strongly lauded for it both domestically and internationally,” political commentator Bryce Edwards told Reuters.

When she went to Christchurch on Saturday, a day after the attacks, Ardern visited members of the refugee and Muslim community. Dressed in black and wearing a Muslim-style headscarf known as a hijab, she tearfully told them that the whole country was “united in grief.”

Wearing hijab was “a sign of respect,” wrote Negar Mortazavi, an Iranian American journalist and commentator.

It was not just her dress that won her more fans abroad. Many people also praised her pledge to cover the funeral costs of all 50 victims and offer financial assistance to the families, as well as her swift action on gun control. Her government will introduce gun measures in Parliament next week.

Sadiq Khan, the mayor of London, tweeted a photo of Ardern hugging a Muslim woman and noted that, when in London last year, she had talked about “the importance of inclusivity and equality in society.”

Adil Ray, a British actor and TV presenter, said he was “really impressed” with Ardern for her “swift, strong leadership.”

Cihangir Islam, a Turkish lawmaker from an opposition Islamist party, also praised Ardern. She “says to Muslims in pain, ‘You, you’re us!’ She symbolically covers her head when she goes to a home for condolences; she boldly underlines her respect and solidarity. How thirsty we have become for justice and mercy in state administration,” Islam wrote.

Abdulkhaleq Abdulla, a professor of political science in Dubai, said she was “stoic and firm.”

A video showing Ardern hugging a Muslim woman and consoling her caused a similar reaction.

“Can you imagine having a leader of a country showing this kind of empathy? Thank you, Jacinda Ardern, for reminding the world what a Leader is and could be,” London literary agent Jonny Geller wrote in a post that has garnered 58,000 likes.

The fact that a world leader covered her hair to meet Muslims quickly became a symbol of Ardern’s approach.

One particular photo captured the public imagination. It is a photo of Ardern, listening intently with an agonized look on her face and her hands clasped together. It has been shared widely on social networks, lauded as a portrait of a compassionate leader.

The photo was taken by Kirk Hargreaves, who used to be a photographer for the Christchurch newspaper the Press but now works for the Christchurch City Council. It was shared on the council’s Twitter page.

“The moment I saw her face pop up, and what was happening with the flowers, I fully knew [it was important]. It's a religious photo in a way, a photo of a mix of religious symbolism. It looks like stain glass, there's the Muslim hijab, and colours of Hindu religion. It's a universal picture,” Hargreaves told the Sydney Morning Herald.

“The human empathy and all those amazing human traits she’s showing in the picture, I’m glad people resonated with that,” he said.

Faiza Ali, a community organizer in New York, tweeted the photo, calling Ardern a “remarkable leader.”

The Crisis Magazine, the official publication of the NAACP, also tweeted the photo, saying Ardern showed “Dignity. Grace. Courage.”

Kareem Fahim and Zeynep Karatas in Istanbul contributed to this report.