Quebec police said worshipers were praying on the ground floor of the mosque when the shooting began just before 8 p.m., CBC News reported.
Early Monday, Quebec Provincial police said that one of the two men detained eventually surrendered after calling police from the side of a road at Île d'Orléans, some 20 kilometers outside Quebec City, after the attack, saying he was armed but ready to cooperate.
"The suspect dialed 911 and identified as being involved in the incident," Andre Goulet, the chief inspector of the Quebec Provincial Police said.
The other suspect was detained at the scene, Goulet said. Police said it was too early to discuss motives, or whether there had been any foreign involvement.
President Donald Trump reached out to Trudeau to express his condolences and offered to provide any assistance needed.
A specialized terrorism unit, made up of all branches of Québécois law enforcement, was deployed to investigate the shooting, and extra security was put in place at mosques.
Quebec Premier Couillard had earlier said that the provincial government was mobilizing to ensure the safety of residents.
A video posted by the mosque on Sunday night showed a heavy police presence at the scene.
The attack came as protests were held around the US after President Donald Trump placed a ban of refugees coming from seven Muslim-majority countries. Canada's government said Sunday that it would assist any US-bound travelers who had been stranded in Canada because of the refugee ban.
The New York Police Department also said in a statement that it had directed special attention to all mosques and house-of-worship locations in the city. And Critical Response Command personnel have been assigned to certain mosque locations.
The mosque at the centre of the Canadian attack, the Islamic Cultural Centre of Quebec City, was founded in 1985, according to its Facebook page. And it's not the first time it has been targeted. In June 2016, during the Muslim holiday of Ramadan, a pig's head was left in front of the mosque.