Prince William has called for extremism to be stamped out and pushed for reform of social media while visiting Christchurch's Muslim community.
Prince William has called for unity in eradicating extremism as he met survivors of the New Zealand mosque shootings.
Gathering on Friday with members of the Muslim community at Christchurch's Al Noor mosque, where 42 of the March 15 attack's victims were killed, the Duke of Cambridge spoke of how the city had demonstrated a way to fight hate with love and said "extremism in all its forms" had to be defeated.
"The message from Christchurch and the message from Al Noor and Linwood mosques could not be more clear - the global ideology of hate will fail to divide us," he said.
With video of the attack that killed 50 live-streamed and widely circulated on Facebook, and much concern about the presence of white supremacy online since, William also pointed to a need to change the internet.
"We must unite to reform the social technology that allowed hateful propaganda to inspire the murder of innocents," he told the audience of about 100.
During the speech that began in Maori and then Arabic, the Duke also praised the compassionate approach the community, country and Prime Minister Jacinda Ardern - in attendance - had taken in the aftermath of the shootings.
"In a moment of acute pain, you stood up and you stood together. And in reaction to tragedy, you achieved something remarkable," he said.
"In the weeks that followed March 15, the moral compass of the world was centred here in Christchurch."
Farid Ahmed, whose wife Husna Ahmed died at the Al Noor Masjid, spoke before the Prince, saying "we have to keep up hope and not surrender to hatred".
Ardern later described the meeting inside with survivors as emotional and the Duke's words as "powerful".
William also attended the Linwood mosque, the second terror attack site, later in the day.
But while much of his two-day visit to New Zealand has been solemn, low-key and under heavy police guard, due to ongoing security fears, it ended on a more conventionally royal note.
Hundreds of watchers gathered along the banks of Christchurch's Avon River to see the Duke take a stroll and a lay a wreath at the city's earthquake memorial.
The lingering security situation didn't put the second-in-line to the throne off from shaking hands and taking plenty of time to chat with the enthusiastic public, as armed officers stood watching and busses blocked nearby roads.
The Prince's second day in New Zealand began with an appearance at Christchurch Hospital, where five of those injured in the attack are still in care.
It wasn't the first stop William had made at a hospital since landing in the country.
Between public engagements on Thursday, he managed a quiet visit to a five-year-old girl in Auckland who was critically injured in the attack and recently woke from a coma.
Footage posted by Kensington Palace showed the Duke at the child's bedside, answering questions about his own daughter, Charlotte.
William's first day in New Zealand began with a tribute to Australian and New Zealand soldiers at an Anzac Day service in Auckland, again alongside Ardern, who earlier greeted him with a hongi, a traditional Maori welcome that involves the pressing together of noses.
The Prince visited Christchurch following the deadly 2011 earthquake and last with wife Catherine, who hasn't joined him this week, in 2014.
He is expected to leave the country shortly.