Étienne Doyon, a spokesman for the Quebec police, told reporters at the scene that the attack on the mosque, the Islamic Cultural Center of Quebec, had occurred around 8 p.m. At a news conference early Monday the police confirmed the six fatalities and said that two suspects had been arrested.
The attack shook Canada, a country where mass shootings are uncommon, and came as the country has become known as a beacon for refugees fleeing warfare and terrorism in Muslim-majority nations.
Mr. Trudeau assailed what he called "this terrorist attack on Muslims in a center of worship and refuge.”
"It is heart-wrenching to see such senseless violence,” he said in a statement early Monday. "Diversity is our strength, and religious tolerance is a value that we, as Canadians, hold dear.”
On Twitter, Martin Coiteux, the minister of public safety in Quebec, said that "the police systems for dealing with terrorist acts have been activated” in the wake of the shooting. "Ensuring the safety of the population is our priority,” he wrote.
About 765,000 people live in the city of Quebec, and 6,760 of them identified themselves as Muslims during the last national census.
Radio-Canada, the French-language service of the Canadian Broadcasting Corporation, said the area surrounding the mosque had been sealed off by the police after the attack.
Last June, a pig’s head was left at the door of the mosque in the middle of Ramadan. Practicing Muslims regard pork as unclean and do not eat it.
The attack comes after Mr. Trudeau said that Canada stood ready to continue welcoming refugees from terrorism and war as President Trump’s executive order on immigration stranded people around the world and provoked condemnation that it was directed at Muslims.
In the wake of the Quebec shooting, the New York City police stepped up protection of mosques, Mayor Bill de Blasio said on Twitter.