CHRISTCHURCH, New Zealand — Prime Minister Jacinda Ardern has been the sunny face of New Zealand, celebrated as the nation’s youngest leader in 150 years, the one who gave birth in office and brought her baby to the floor of the United Nations. At 38, she’s pitched progressive politics and her nation’s charms to Stephen Colbert and the “Today” show. Vogue magazine called her the “anti-Trump.”

Now, with the massacre of 50 people at two mosques by a gunman espousing anti-Muslim, anti-immigrant hatred, Ms. Ardern is back in the international spotlight, but the glamour is gone. Instead, she speaks for New Zealand at a moment of national pain, her vision of kindness in politics tested by the worst mass murder in her country’s modern history.

“We represent diversity, kindness, compassion. A home for those who share our values. Refuge for those who need it,” she told reporters at Parliament as the horror of the shootings began to unfold on Friday, her words broadcast around the world even as the killer’s video and manifesto of hatred were spreading online. Ms. Ardern herself had been emailed a copy of the manifesto minutes before the massacre began.

“You may have chosen us,” she said of the gunman, “but we utterly reject and condemn you.”

That sentiment has echoed across New Zealand in the aftermath of the shootings. In a country of less than five million people, prized for its safety and natural beauty, people had the same refrain: Things like this do not happen here.