The man accused in the slayings of six men at a Quebec City mosque has changed his mind and pleaded guilty.

Alexandre Bissonnette originally pleaded not guilty to the 12 charges Monday morning but that afternoon announced he wanted to plead guilty.

Superior Court Justice Francois Huot refused to accept the pleas Monday pending a psychiatric assessment and imposed a publication ban. But the judge agreed Wednesday to accept the pleas.

Bissonnette faced 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 the shooting began during evening prayers.

Bissonnette said he didn't want the families to have to "relive the tragedy."

When told he would get a life sentence he answered, "I understand."