QUEBEC CITY - A Canadian man known for his far-right, nationalist sympathies pleaded guilty Wednesday to the killing last year of six worshippers at a Quebec mosque - a surprising turn of events in a case that shocked the nation. The rampage on January 29, 2017, which also left more than 30 injured, was one of the worst attacks on an Islamic place of worship in the West. Described in the immediate aftermath by Prime Minister Justin Trudeau as a “terrorist attack,” the shooting spree was a brutal blow to Canada’s multicultural society, and to a nation that welcomes tens of thousands of refugees each year.

Alexandre Bissonnette, 28, opened fire on a cold, snowy night at the end of Sunday prayers at Quebec City’s Islamic Cultural Center, a mosque located in a normally quiet neighborhood.

He had initially pleaded not guilty at the start of the trial on Monday on the advice of his lawyers, but apparently had a change of heart.

“I’ve decided to plead guilty to all of the charges ... in order to prevent the families of the victims from having to relive” the horrors of the attack, said Bissonnette, who also faced six counts of attempted murder.

Sobs erupted in the courtroom as Judge Francois Huot accepted Bissonnette’s guilty plea, following a court-ordered psychiatric assessment.

“I find you guilty of these murders,” he said.

Bissonnette, who was a university student at the time of the shooting, could now face a life sentence, or a minimum of 25 years in prison.

In court, Bissonnette - who police say called an emergency line and confessed shortly after the shooting, sobbing over the phone - read aloud from a crumpled piece of paper, saying: “I bitterly regret what I did, the lives that I destroyed.

“I am neither a terrorist, nor an Islamophobe,” he said. “I do not know why I did a foolish thing like that, and still today I’m having a hard time believing it.”

Introverted and educated, Bissonnette had been described after his arrest as a white supremacist opposed to Muslim immigration, but not affiliated with any group.

He told the court on Wednesday how he had been “swept away by fear and by horrible despair that had brought on thoughts of suicide.”

Turning to the families and friends of the victims and survivors packed into the courtroom, he offered an apology but added, “I know my actions are unforgivable.”

The six victims - Ibrahima Barry, Mamadou Tanou Barry, Khaled Belkacemi, Abdelkrim Hassane, Azzeddine Soufiane and Aboubaker Thabti - were Canadian dual nationals born in Algeria (two), Guinea (two), Morocco and Tunisia, and who had long ago resettled in Quebec.

They were a scholar, a butcher, a daycare operator, a food industry worker, a public servant and a computer programmer - all connected by faith.

The president of the mosque, Boufeldja Benabdallah, expressed relief.

“We are satisfied with the verdict,” he said outside the courtroom.

“The evil is done,” he added. “It will be up to the families to decide whether to forgive him.”