More than 50 people were at the Quebec Islamic Cultural Centre when the shooting erupted Sunday night. Some of the wounded were gravely injured, Quebec provincial police spokeswoman Christine Coulombe said early Monday. The dead ranged in age from age 35 to 70, she said, and 39 people were unharmed.
One suspect was arrested at the scene and another nearby in d'Orleans, and police said they did not believe there were other suspects. Police didn't release names of the suspects or give a possible motive.
Prime Minister Justin Trudeau and Quebec Premier Philippe Couillard both characterized the attack as a terrorist act, which came amid heightened tensions worldwide over President Donald Trump's travel ban on several Muslim countries.
"We condemn this terrorist attack on Muslims in a center of worship and refuge," Trudeau said in a statement. "It is heart-wrenching to see such senseless violence. Diversity is our strength, and religious tolerance is a value that we, as Canadians, hold dear.
"Muslim-Canadians are an important part of our national fabric, and these senseless acts have no place in our communities, cities and country," he said.
Tonight, Canadians grieve for those killed in a cowardly attack on a mosque in Quebec City. My thoughts are with victims & their families.— Justin Trudeau (@JustinTrudeau) January 30, 2017
Canada is generally very welcoming toward immigrants and all religions, but the French-speaking province of Quebec has had a long-simmering debate about race and religious accommodation. The previous separatist government of the province called for a ban on ostentatious religious symbols such as the hijab in public institutions.
In the summer of 2016 a pig's head was left on the doorstep of the Quebec Islamic Cultural Centre in the middle of Ramadan, when Muslims fast from dawn to sunset. Practicing Muslims do not eat pork.
"The Muslim community was the target of this murderous attack," Couillard said at an early morning news conference. He said solidarity rallies would be held across Quebec on Monday.
Quebec City Mayor Regis Labeaume, appearing shaken, said, "No person should have to pay with their life, for their race, their color, their sexual orientation or their religious beliefs," Labeaume said.
Cultural Centre President Mohamed Yangui said the shooting in occurred in the men's section of the mosque. He said he wasn't at the center when the attack occurred, but he got some details from people on the scene.
Ali Hamadi said he left the mosque a few minutes before the shooting and said a friend, Abdelkrim Hassen was killed. He said Hassen, who worked in information technology for the government, had three daughters and a wife, whom he had to notify of the death.
Quebec City police spokesman Constable Pierre Poirier said the mosque had been evacuated and the situation was under control.
Trudeau had earlier reacted to Trump's visa ban for people from some Muslim-majority countries by tweeting Saturday: "To those fleeing persecution, terror & war, Canadians will welcome you, regardless of your faith. Diversity is our strength #WelcomeToCanada."
Trudeau also posted a picture of himself greeting a Syrian child at Toronto's airport in late 2015. Trudeau oversaw the arrival of more than 39,000 Syrian refugees soon after he was elected.
The mayor of Gatineau, Quebec, near Canada's capital of Ottawa, said there would be an increased police presence at mosques around his city following the attack.
The New York Police Department also said it was stepping up patrols at mosques and other houses of worship.
"NYPD is providing additional protection for mosques in the city. All New Yorkers should be vigilant. If you see something, say something," New York City Mayor Bill de Blasio said on Twitter.
"Our prayers tonight are with the people of Quebec City as they deal with a terrible attack on a mosque. We must stand together," de Blasio said in another tweet.
Canada's public safety minister, Ralph Goodale, said on Twitter Sunday that he was deeply saddened by the loss of life. His office said no motive had been confirmed.
Francois Deschamps, an organizer of a refugee-support group in Quebec City, said the motive for Sunday's attack was unknown, but right-wing groups are very organized in Quebec City, distributing fliers at the university and plastering stickers around town.
Deschamps said he has received death threats after starting a refugee support group on Facebook and people have posted his address online.
"I'm not very surprised about the event," Deschamps said.
The Canadian Council of Imams said in a statement that "Islamophobia has killed innocent Canadians."
"We ask all decent people to stand against hatred of Islam and Muslims in any forum," the statement read.
"Our message to anyone in the Canadian Muslim community who may experience Islamophobia is not to suffer in silence."
Associated Press writer Sean Farrell in Montreal contributed to this report. Rob Gillies reported from Toronto.