The man, Alexandre Bissonnette, faced six charges of first-degree murder and six more of attempted murder. More than 50 people were at the Islamic Cultural Centre in January last year when the shooting began during evening prayers. Six men ages 39 to 60 were killed.
"Every minute of my existence I bitterly regret what I did, the lives I have destroyed, the pain and suffering I have caused to so many people, without forgetting the members of my own family," he said as he read out a letter in court. "I am ashamed of what I did."
Bissonnette, 28, spoke shortly after a judge accepted his guilty pleas. Many people in the courtroom burst out sobbing and held hands as the judge confirmed the pleas.
Bissonnette had pleaded not guilty to the 12 charges on Monday morning, but he announced that afternoon that he wanted to plead guilty.
Superior Court Justice Francois Huot refused to accept the pleas Monday pending a psychiatric assessment to ensure that Bissonnette fully understood the consequences of his decision. Huot placed a publication ban on Monday afternoon's proceedings but agreed Wednesday to accept the 12 guilty pleas.
Let our news meet your inbox. The news and stories that matters, delivered weekday mornings.
In reading his letter, Bissonnette said he had been "overcome by fear, by negative thoughts and a sort of horrible kind of despair" before the shootings.
"It's though I was battling a demon that finished by winning out. ... I would like to ask for forgiveness for what I did, but I know my acts are unforgivable."
On Monday, Bissonnette said he wanted to plead guilty to "avoid a trial and for the victims to not have to relive this tragedy."
Bissonnette told the judge then that he had been thinking for some time of pleading guilty but that he was missing certain pieces of evidence, which were relayed Sunday.
When Huot asked him whether he was fully aware of what he was doing, Bissonnette replied, "Yes."
Huot asked Bissonnette whether he knew he would be getting a life sentence, and he answered, "I understand."
Huot also asked him whether he understood that he could receive consecutive sentences, meaning 150 years in prison.
Amir Belkacemi, whose father, Khaled Belkacemi, 60, was killed, said no one wanted to live through the trauma again.
"That the trial won't have to take place, it's a good thing for us. It's a good thing for everyone in the community," Belkacemi said. "Very relieved."
Jury selection had been scheduled to start next Tueday for a trial that had been projected to last two months.
Those who monitor extremist groups in Quebec described the French-Canadian 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.