The murder of 50 Muslim worshipers in New Zealand, allegedly by a 28-year-old Australian white supremacist, will be long scrutinized for the way violent hatreds are spawned and staged on social media and the internet. But now the world should learn from the way Jacinda Ardern, New Zealand’s prime minister, has responded to the horror.

Almost immediately after last Friday’s killings, Ms. Ardern listened to her constituents’ outrage and declared that within days her government would introduce new controls on the military-style weapons that the Christchurch shooter and many of the mass killers in the United States have used on their rampages. And she delivered.

On Thursday, Ms. Ardern announced a ban on all military-style semiautomatic and automatic weapons, parts that can be used to turn other rifles into such weapons and high-capacity ammunition magazines. “It’s about all of us,” she said, “it’s in the national interest and it’s about safety.”

Earlier in the week, she told Parliament that social media sites must address the ease with which the internet can be used to spew hate and images of violence. “We cannot simply sit back and accept that these platforms just exist and that what is said on them is not the responsibility of the place where they are published,” she said. “It cannot be a case of all profit, no responsibility.”