“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.”

Christine Colombe, a spokeswoman for the Quebec Provincial Police, said the victims ranged in age from 35 to 70 and said that 39 people who were in the mosque were not hurt.

The police had not yet identified a motive in the shootings, saying the investigation was just beginning. Ms. Colombe said that one of the two suspects was arrested at the scene of the shooting, while another was apprehended nearby on Île d’Orleans.

The police said that some of those wounded in the shooting were seriously hurt.

On Twitter, Martin Coiteux, the provincial minister of public safety, 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.

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.