(CNN) A man who opened fire at a Quebec City mosque, killing six people in 2017, has been sentenced to life in prison with the possibility of parole after 40 years.

Alexandre Bissonnette, 29, pleaded guilty last year to six counts of first-degree murder and six counts of attempted murder in connection to the 2017 attack at the Quebec Islamic Cultural Center.

Witnesses said Bissonnette stormed the mosque during evening prayers on a Sunday and began firing indiscriminately into the crowd of men, women and children.

Alexandre Bissonnette arrives at a Quebec City courthouse in Febuary 2017.

Six worshippers were killed: Mamadou Tanou Barry, 42; Abdelkrim Hassane, 41; Khaled Belkacemi, 60; Aboubaker Thabti, 44; Azzeddine Soufiane, 57; and Ibrahima Barry, 39.

During the sentencing hearing Friday, Superior Court Justice Francois Huot described the attack as a hate crime.

Read More