Judge rejected a prosecution request for a 150-year sentence for Alexandre Bissonnette

A 29-year-old who shot dead six worshipers at a Quebec City mosque in the worst anti-Muslim attack in the West got life in prison Friday.

Alexandre Bissonnette will have to wait 40 years — longer than usual — before he can apply for parole.

Judge Francois Huot rejected a prosecution request for a 150-year sentence, which would have been the longest ever in Canada, saying this would be a cruel and unusual punishment under Canadian law.

But he also noted the killer's "visceral hatred of Muslim immigrants" in his decision.

Ahmed Cheddadi, who was wounded in the attack, said the sentence was appropriate in that he found it unlikely that Bissonnette would ever be released.

The killer's "highly premeditated" attack on the mosque will go down in Canadian history "written in blood" as one of this country's worst tragedies, Huot said in court.

Bissonnette's actions sought to "undermine our fundamental societal values," he added.

A university student at the time of the shooting, Bissonnette was seduced by nationalist and supremacist ideologies into committing this "unjustified and deadly" massacre, Huot said.

As the 240-page verdict was read over a six-hour period, Bissonnette sat quietly in the packed courtroom, gazing at his feet while his parents and several friends and family of the victims wiped tears from their eyes.

On the evening of January 29, 2017, Bissonnette burst into the Quebec City mosque and unleashed a hail of bullets on the 40 men and four children who were chatting amongst themselves after evening prayers.

Six men were killed and five were seriously injured, one of whom is now quadriplegic.

The victims were all dual nationals who emigrated to Canada over recent decades: two Algerians, two Guineans, a Moroccan and a Tunisian.

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