A Canadian man accused of killing six Muslim worshippers at a mosque in Quebec City in 2017 has changed his mind and pleaded guilty to all charges.

Alexandre Bissonnette, 28, faced six counts of first-degree murder and six of attempted murder for the attack.

The former university student changed his plea of not guilty on Wednesday, which will avoid a trial.

On 29 January he stormed into the Quebec Islamic Cultural Centre and shot at those gathered for prayers.

"I am ashamed of what I did," he told a Quebec courtroom. "I am not a terrorist, I am not an Islamophobe."

Bissonnette had just entered a plea of not guilty on Monday and jury selection was to begin as early as 3 April.

But five hours later, he reversed his plea, CBC reported on Wednesday.

The judge had ordered a publication ban on the reversal until a psychological assessment could be conducted.

Court-ordered psychiatrist Sylvain Faucher told the court on Wednesday that after meeting Bissonnette, he believes he changed his mind because he felt remorse and wanted to spare the families of the victims from another "collective tragedy".

He made no plea deal and could face 150 years in prison if he is sentenced consecutively.

Bissonnette admitted to killing Khaled Belkacemi, 60, Azzedine Soufiane, 57, Abdelkrim Hassane, 41, Mamadou Tanou Barry, 42, Aboubaker Thabti, 44, and Ibrahima Barry, 39, in the January attack.

Five others were seriously injured in the Sunday night shooting, including Aymen Derbali, who is now paralysed.

In October, the Crown added a sixth charge of attempted murder against the accused to include all 35 witnesses in the mosque during the attack.

The news drew mixed reaction from family members of victims.

"No one really wants to live those traumatic days again," said Amir Belkacemi, the son of victim Khaled Belkacemi, outside the courtroom.

Mohamed Labidi, president of Quebec City's Islamic Cultural Centre, said Bissonnette's statement leaves many questions unanswered.

"We still need another explanation, because the small words that he announced, they don't convince us about all of the crime," he said.

"A lot of victims, a lot of suffering, at the end, for nothing."

Bissonnette had rented a flat with his twin brother near the mosque, CBC reported.

He studied political science and anthropology at Laval University, and teachers described him as polite. But some say he had started to express extremist tendencies before the shooting.

Fellow student Vincent Boissoneault told the Globe and Mail that when French far-right politician Marine Le Pen visited Quebec City, Bissonnette shared extreme views in support of her online.

"I wrote him off as a xenophobe," Mr Boissoneault said. "I didn't even think of him as totally racist, but he was enthralled by a borderline racist nationalist movement... [But] it never occurred to me he might be violent."