There were a few dozen people in the Islamic Cultural Centre of Quebec and it is feared multiple of them may be wounded,” the Canadian Broadcasting Corporation reported.
“Why is this happening here?” mosque president Mohamed Yangui said. “This is barbaric.”
Prime Minister Justin Trudeau sent his condolences via social media.
"Tonight, Canadians grieve for those killed in a cowardly attack on a mosque in Quebec City. My thoughts are with victims & their families," he tweeted.
Two suspects are in custody but police said there may be other shooters involved, according to CTV television.
The Huffington Post Canada news website reported that a bystander said in Arabic: "This is the result of Trump”, prompting a response from Quebec Premier Philippe Couillard who posted a message on Twitter.
"Quebec categorically rejects this barbaric violence," he said. "All our solidarity to those close to the victims, the injured and to their families.”
A large perimeter has been set up to secure the crime scene where a heavy police presence continues, the mosque’s Facebook page shows.
The shooting occurred about 8 p.m. local time (0100GMT).
Ralph Goodale, Canada’s public safety minister, tweeted that he is saddened by the deaths and his office said no motive has been confirmed.
In June, a pig’s head was left at the mosque's door along with a note, “Bon appetit”, during the holy month of Ramadan. Consumption of pork is prohibited for Muslims.
In 2015, a man in a Joker’s mask in a YouTube video complained about and threatened Quebec Muslims, saying that if the government would not do anything about them, he would.
The attack comes amid widespread protests across the U.S. in defiance of an executive order signed by President Donald Trump that bans immigrants and refugees from seven Muslim-majority countries.