CHRISTCHURCH, New Zealand — Public grief turned to relief and joy here Thursday as New Zealanders celebrated the life sentence handed down to Brenton Tarrant, the white supremacist who slaughtered 51 people and injured dozens of others at two mosques in Christchurch last year.

After an emotional four-day hearing in which surviving victims and relatives of those killed confronted the gunman face-to-face, Tarrant, 29, showed little reaction as Judge Cameron Mander consigned him to spending his remaining days behind bars, with no prospect of parole, for the deadliest act of violence in the country's modern history.

Tarrant's victims wept and hugged one another as he was led away. Outside the court complex in the city center, crowds of people gathered, some holding signs with messages of support for the victims and their families and for the city's Muslim community. Others sang traditional Maori songs and shed tears of elation, relieved that the gunman would never be released.

“From what I can gauge, you are empty of any empathy for your victims,” Mander told Tarrant, describing the gunman as “a deeply impaired person motivated by a base hatred of people you perceive to be different.”

“You remain entirely self-
absorbed. You have offered no apology or acknowledgment of the harm you caused,” the judge continued. “Your focus appears to be on yourself and the position you find yourself in.”

Less than 18 months earlier, and less than two miles away, Tarrant began his murderous rampage at the Al Noor Mosque. Armed with shotguns and assault rifles, he burst in during Friday prayers and began firing indiscriminately at worshipers, killing 44 people there before moving on to kill seven others at the Linwood Islamic Center across town.

He was eventually confronted and chased away by a man, Abdul Aziz Wahabzadah, who fought off Tarrant by throwing a credit card machine at him, saving many lives. Wahabzadah was praised by Mander this week for his courage, and he was hailed as a hero by the city’s residents, who paraded him on their shoulders Thursday after the sentencing.

The attacks of March 15, 2019, stunned a small, tolerant nation accustomed to low crime rates and little history of domestic terrorism. Reflecting that revulsion, the sentence delivered Thursday at the High Court was unprecedented in New Zealand’s history; Tarrant became the first prison inmate who will never be eligible for parole. The country abolished the death penalty for murder in 1961.

The former fitness instructor, who did not speak in his defense during his sentencing hearing this week, pleaded guilty in March to 51 counts of murder, 40 counts of attempted murder and one count of committing a terrorist act. On Thursday he looked on attentively in silence, occasionally resting his head on his right hand, as three lawyers delivered submissions to the judge.

Lawyers told the court that Tarrant, who is Australian, regretted his actions, had changed his beliefs and wanted to meet his victims — many of whom were holding white flowers in the hearing room Thursday.

Prosecutor Mark Zarifeh questioned the sincerity of Tarrant’s statements to psychiatric and judicial officials, in which the gunman described his actions as “unnecessary, abhorrent and irrational” and professed to have been influenced by political views he no longer holds. Describing Tarrant as New Zealand’s worst murderer, Zarifeh cited the gunman’s statement to officials that he was deeply unhappy and committed his crimes because he “wanted to damage society as an act of revenge.”

Zarifeh said a life sentence without parole was appropriate, noting the “extreme violence, brutality, cruelty, callousness” of the gun rampage, the life-altering trauma to survivors and the careful planning that preceded Tarrant’s assault.

Tense scenes played out in the court this week as distraught victims confronted Tarrant, labeling him a “monster,” a “loser” and “the devil.”

On Wednesday, Sara Qasem brought some in the room to tears as she described her father, who died in the massacre, as a hero and a “shining, glimmering man.” She told Tarrant not to forget his name: Abdelfattah Qasem. “I want to hear my dad’s voice, my baba’s voice,” she said before pausing to cry.

Wahabzadah, who fought off Tarrant at the Linwood Islamic Center on the day of the attacks, told the gunman Wednesday that he “should thank God on that day that I didn’t catch you. This government would save a lot of money.”

On Thursday, Wahabzadah welcomed the sentence of life without parole. “That is what we were aiming for, and we got it,” he said, describing Tarrant as a “coward” and an “idiot” who had thrown his life away.

Nearby, Kateah Shankland, 12, was on her way with her parents to pay their respects at the Al Noor Mosque and show support for the Muslim community.

“We just wanted to make sure that they know that we are also here with them at this very tough time,” she said.

Judicial authorities had been eager to prevent Tarrant, who had posted a racist manifesto online, from using the court as a platform to extol extremist views. A separate official inquiry is examining whether intelligence and law enforcement agencies missed warning signs or failed to investigate tips about the gunman.

The mosque bloodshed prompted New Zealand Prime Minister Jacinda Ardern — who faces elections in October — to tighten the country’s gun laws, banning most semiautomatic weapons and assault rifles and initiating a buyback of existing firearms.

Commenting on the sentence Thursday, Ardern said the trauma of the attacks would not be easily healed, as she extended sympathies to Tarrant’s victims and the Muslim community.

“Nothing will take the pain away,” she said. “But I hope you felt the arms of New Zealand around you through this whole process, and I hope you continue to feel that through all the days that follow.”