By Peter Wilson*
Analysis - The Muslim world was appalled by the mosque massacres and it was the compassion shown by ordinary Kiwis that helped turned the tide at an emergency meeting of representatives from 57 nations.
It must have been with considerable trepidation that Foreign Minister Winston Peters left for the emergency meeting of the Organisation of Islamic Co-operation.
Ministers from the OIC's 57 member nations were gathered in Istanbul to respond to the mosque attacks and discuss "combatting hatred and intolerance against Muslims".
It was a daunting arena to walk into when 50 Muslims had just been murdered in New Zealand, and Mr Peters knew it.
"It could all have gone so wrong," he said when he returned this week, and he was right.
The OIC describes itself as "the voice of the Muslim world", and the Muslim world was appalled by the slaughter.
Mr Peters met the foreign ministers from those countries, talked to them and showed them videos of the way ordinary Kiwis had responded.
The presentation included an Imam saying prayers in our Parliament. "There was weeping and sobbing when they saw those images," Mr Peters said.
The representatives already knew how Prime Minister Jacinda Ardern had reacted. An image of her wearing a hijab, her arms around a Muslim woman, lit up the world's tallest building, the Burj Khalifa in Dubai.
It was a stark contrast to the "hatred and intolerance" the OIC had been called to discuss, and it worked, perhaps in part because it was so unusual. A CNN reporter in Christchurch, reporting on the aftermath of the attacks, said she had been through an amazing experience.
"When the world is so divided, these people came together."
Since his return, Mr Peters has been strongly criticised for apparently falling asleep during the formal part of the meeting and failing to confront Turkish President Recep Tayyip Erdogan over his use of the attacker's livestream video during his election campaign.
That criticism may be valid, but there was a bigger picture - the foreign minister was running an international damage control operation and he succeeded.
Now the focus at home is going to be on what can be done to ensure it can't happen again,. or make it less likely to happen again.
The Royal Commission of Inquiry will come up with recommendations but that is so far down the track that the government can't afford to wait for it.
Ms Ardern moved swiftly to ban semi-automatic weapons and assault rifles and the legislation will soon be introduced to Parliament under urgency.
She's using the momentum for change generated by the mosque attacks and the bill will probably be passed unanimously.
Only one MP, ACT leader David Seymour, is holding out. He's complaining that the process is rushed. "You do not defy terrorism and defend our democracy by throwing out democratic procedure such as parliamentary scrutiny, and the public's right to submit in full, at the first sign of trouble," he said.
Mr Seymour will no doubt make those points during the debate on the bill, but he hasn't yet decided whether he will vote for it and says he wants to see the details in the bill first. He probably will vote for it, and Parliament will have put through legislation with unusual consensus.
Another much more contentious debate is still to take place. That is the future of the security agencies, the SIS and the GCSB. They are the guardians on the nation's safety, and in this tragic case they failed.
Both have said they had no intelligence on the attacker, and didn't receive any from Five Eyes partners the US, Australia, Canada and the UK. He was below the radar, with disastrous results.
Precisely why they failed to notice him probably won't be known until the royal commission reports, because finding out is one of its main tasks.
But well before that there are likely to be changes in the way they operate.
Already, the National Party is calling for it. Leader Simon Bridges told Morning Report that the agencies were operating with both hands tied behind their backs.
Mr Bridges said Project Speargun, abandoned by the previous government in 2013, should be reconsidered.
It would have scanned internet traffic coming into New Zealand, and at the time it was considered to be too intrusive.
But Mr Bridges says circumstances have changed. "Where we draw the line must now be reconsidered."
The security agencies have already made the point, in their own defence, that they don't have the legal authority, the technical means or the resources to carry out mass surveillance of New Zealanders.
Giving the agencies more spying power has never been easy, and has always run into stiff opposition. Labour has always been averse to it, not least the man now in charge of the agencies, Justice Minister Andrew Little.
However, he now knows all there is to know about the agencies, which he didn't before when he was in opposition. He knows how and why they operate, and could decide, like Mr Bridges, that it's time to reconsider where the line is drawn.
* Peter Wilson is a life member of Parliament's press gallery, 22 years as NZPA's political editor and seven as parliamentary bureau chief for NZ Newswire.