A French-Canadian man who shot dead six Muslim men in a Quebec City mosque in 2017 has been sentenced to serve 40 years in prison before being eligible for parole.

Quebec Superior Court Justice Francois Huot called Alexandre Bissonnette's attack gratuitous and insidious as he handed down the sentence Friday. Several people in the room wept as the judge read a detailed account of the shooter's actions.

Bissonnette, now 29, pleaded guilty last March to six charges of first-degree murder and six of attempted murder. More than 50 people were at the Islamic Cultural Centre in January 2017 when he began shooting during evening prayers.

Bissonnette received a life sentence and can apply for parole after 40 years, but that doesn't mean he's likely to get parole.

The judge began his ruling on Friday by saying the day of the murders "will forever be written in blood in the history of this city, this province, this country."

Those who monitor extremist groups in Quebec described the university student as someone who took extreme nationalist positions at Laval University and on social media. He was a supporter of French far-right leader Marine Le Pen and U.S. President Donald Trump.

Quebec's previous premier previously acknowledged the province has its "demons" in terms of attitudes toward Muslims.

Canada is generally welcoming toward immigrants and all religions, but the French-speaking province of Quebec has had a long-simmering debate about race and religious accommodation.

The prosecution had recommended that his six life sentences be served consecutively, which would have meant 150 years before being eligible for parole. His lawyer had argued the sentences should be served concurrently, making him eligible for parole after 25 years.

Huot said a sentence of 50 years or more would constitute cruel and unusual punishment.

Six men, aged between 39 and 60, were killed when Bissonnette stormed the mosque and opened fire on Jan. 29, 2017. Witnesses described a scene of chaos as worshippers scrambled to find friends and loved ones.

Bissonnette was arrested that night in his car on a bridge nearby, after he called 911 to say he wanted to cooperate with police.

The murder victims were Mamadou Tanou Barry, 42; Abdelkrim Hassane, 41; Khaled Belkacemi, 60; Aboubaker Thabti, 44; Azzeddine Soufiane, 57; and Ibrahima Barry, 39.