The massacre on Sunday evening, which Canadian prime minister Justin Trudeau condemned as a "cowardly terrorist attack on Muslims", left five others in critical condition.
A further 12 worshippers managed to escape the chaos with minor injuries.
Police initially arrested two men but later said just one, Alexandre Bissonnette, remained a suspect.
A second person held in connection with the shooting was later described as a witness. One man was arrested at the scene and a second man held after he called 911, police said, The Telegraph reported.
A handgun and at least two assault rifles were also recovered, according to Canadian media reports.
Bissonnette is a French-Canadian student, according to local news website TVA, which cited police sources. A Facebook page reportedly belonging to Bissonnette included "likes" for Donald Trump and Marine Le Pen, the far-right French presidential candidate.
The suspect has made a brief court appearance at which he did not enter a plea. He stared at his feet and fidgeted during the hearing as he appeared in a white prisoner jumpsuit. His next court date is February 21.
A Quebec police spokesman said the suspect's motive was unclear and that there was "no indication" that anyone else was involved in the attack.
Canada is generally welcoming towards immigrants and refugees, but tensions have been simmering in Francophone Quebec over attitudes towards Islam.
Last year, a pig's head was left on the doorstep of the mosque that was attacked on Sunday during Ramadan, when Muslims fast from dawn to sunset. Muslims do not eat pork.
In 2013, police investigated after a mosque in the Saguenay region of Quebec was smeared with what was believed to be pig's blood.
In the neighboring province of Ontario, a mosque was set on fire in 2015, a day after the infamous Paris terror attacks in November.