The scene of a fatal shooting at the Quebec Islamic Cultural Centre in Quebec City on Sunday. REUTERS/Mathieu Belanger

Six people were killed and 17 were wounded when a gunman opened fire at a Quebec City mosque during Sunday-night prayers, in what Canadian Prime Minister Justin Trudeau called a "terrorist attack on Muslims."

Alexandre Bissonnette, a French-Canadian university student, was charged with the premeditated murder of six people, Canadian authorities said Monday evening.

He was also charged with five counts of attempted murder, according to court papers.

Among the six men killed were a butcher, a university professor, a pharmacist and an accountant, according to police and Canadian media.

Police said Bissonnette didn't have a police record, declining to discuss possible motives for the shooting at the Centre Culturel Islamique de Québec, and saying they were confident no other suspects were involved in the attack.

"They consider this a lone wolf situation," a source familiar with the situation told Reuters.

In Washington, U.S. government security experts were leaning to the view that the gunman most likely was motivated by hatred for Muslims, a U.S. government source familiar with official reporting said.

On Monday morning, two suspects were in police custody. But police said Monday afternoon they only considered one of the men a suspect, while the other was a witness.

The man now considered a witness was of Moroccan descent although his nationality was not immediately known, the source said. He was named by media as Mohamed Khadir or Mohammed Belkhadir.

"Six people are confirmed dead — they range in age from 35 to about 70," Quebec provincial police spokeswoman Christine Coulombe told reporters. Five people were critically injured, and 12 were treated for minor injuries, a spokeswoman for the Quebec City University Hospital said.

The mosque's president, Mohamed Yangui, who was not inside when the shooting occurred, said he got frantic calls from people at evening prayers. "Why is this happening here? This is barbaric," he said.

The local paper Le Soleil reported Sunday night that a suspect was armed with an AK-47. A gunman managed to reload his gun three times and was able to move from the ground to the first floor, according to the local newspaper Le Devoir.

The mosque's Facebook page showed several live videos of the crime scene:

Leaders condemn attack, step up security

"We condemn this terrorist attack on Muslims in a center of worship and refuge," Prime Minister Justin Trudeau said in a statement.

"Muslim-Canadians are an important part of our national fabric, and these senseless acts have no place in our communities, cities, and country."

The shooting came on the weekend that Trudeau said Canada would welcome refugees, after US President Donald Trump suspended the US refugee program and temporarily barred citizens from seven Muslim-majority countries from entering the US on national-security grounds.

A Canadian federal Liberal legislator, Greg Fergus, tweeted: "This is an act of terrorism — the result of years of sermonizing Muslims. Words matter and hateful speeches have consequences!"

A police officer patrolling the perimeter near the mosque after the shooting in Quebec City on Sunday. REUTERS/Mathieu Belanger

The premier of Quebec province, Philippe Couillard, said security would be increased at mosques in Quebec City and Montreal.

"We are with you. You are home," Couillard said, directing his comments at the province's Muslim community. "You are welcome in your home. We are all Quebecers. We must continue together to build an open welcoming and peaceful society."

Mayor Bill de Blasio of New York said the police were providing additional protection for mosques in that city after the Quebec shooting, a move that other leaders echoed across the US and Canada. "All New Yorkers should be vigilant. If you see something, say something," he tweeted.

Rising Islamophobia

In June, a pig's head was left on the mosque's doorstep with a note that read, "Bonne appetit," The Star reported. Many Muslims do not eat pork, and local police officers were investigating the incident.

Like France, Quebec has struggled at times to reconcile its secular identity with a rising Muslim population, many of them North African emigrants.

The face-covering, or niqab, became a big issue in the 2015 national Canadian election, especially in Quebec, where the vast majority of the population supported a ban on it at citizenship ceremonies.

Incidents of Islamophobia have increased in Quebec in recent years. In 2013, police officers investigated after a mosque in the Saguenay region of Quebec was splattered with what was believed to be pig blood.

In the neighboring province of Ontario, a mosque was set on fire in 2015, a day after an attack by gunmen and suicide bombers in Paris.

Police officers arriving at the scene of the shooting at the Quebec Islamic Cultural Centre on Sunday. REUTERS/Mathieu Belanger "We are not safe here," said Mohammed Oudghiri, who normally attends prayers at the mosque in the middle-class, residential area but did not on Sunday.

Oudghiri said he had lived in Quebec for 42 years but had become "very worried" and was thinking of moving back to Morocco.

Mass shootings are rare in Canada, which has stricter gun laws than the US, and news of the shooting sent a shock wave through mosques and community centers throughout the mostly French-language province.

"It's a sad day for all Quebecers and Canadians to see a terrorist attack happen in peaceful Quebec City," said Mohamed Yacoub, the cochairman of an Islamic community center in a Montreal suburb. "I hope it's an isolated incident."

Not everyone was surprised by the event. Francois Deschamps, an organizer of a support group for refugees in Quebec City, said he had received death threats after starting the support group on Facebook. Others have posted his address online.

"I'm not very surprised about the event," Deschamps told Associated Press.

French President Francois Hollande also condemned the attack: "The terrorists wanted to attack the spirit of peace and tolerance of the citizens of Quebec," Hollande said in a statement on Monday. "France stands shoulder to shoulder with the victims and their families."

Rebecca Harrington, Portia Crowe, Barbara Tasch, and Reuters contributed reporting.