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

Police said two suspects had been arrested, but gave no more details into what prompted the "terrorist attack", saying the investigation had just begun.

Initially, the mosque president said five people were killed in the shooting, and a witness said up to three gunmen had fired on about 40 people inside the Quebec City Islamic Cultural Centre in Canadainfo-icon's Quebec province. Police said only two people were involved in the attack.

"Six people are confirmed dead - they range in age from 35 to about 70," Quebec provincial police spokeswoman Christine Coulombe told reporters, adding eight people were wounded and 39 were unharmed.

A Reuters eyewitness saw heavily armed tactical police entering the mosque. Police later tweeted: "The situation is under control."

"Why is this happening here? This is barbaric," said the mosque's president, Mohamed Yangui.

Yangui, who was not inside the mosque when the shooting occurred, said he got frantic calls from people at evening prayers. He did not know how many were injured, saying they had been taken to different hospitals across Quebec City.

Embedded rich media on Twitter

Canadian Prime Minister Justin Trudeau said on Twitterinfo-icon: "Tonight, Canadians grieve for those killed in a cowardly attack on a mosque in Quebec City. My thoughts are with victims & their families."

Quebec's prime minister, Philippe Couillard, said in a series of Twitter posts that the government was "mobilized to ensure the security of the people of Quebec"."Quebec categorically rejects this barbaric violence," he wrote. "Solidarity with Quebec people of Musliminfo-icon faith."

Rising Islamophobia

The Islamic Cultural Center of Quebec, which is also known as the grand mosque of Quebec, had already been the target of hate: a pig's head was left on the doorstep last June during the Muslim holy month of Ramazaninfo-icon.

Zebida Bendjeddou, who left the mosque earlier on Sunday evening, said the centre had received threats.

"In June, they'd put a pig's head in front of the mosque. But we thought: 'Oh, they're isolated events.' We didn't take it seriously. But tonight, those isolated events, they take on a different scope," she said.

Bendjeddou said she had not yet confirmed the names of those killed, but added: "They're people we know, for sure. People we knew since they were little kids."

Like Franceinfo-icon, mostly French-speaking 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 investigated after a mosque in the Saguenay region of Quebec was splattered with what was believed to be pig blood.

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

The attack comes as Canada has vowed to open its arms wide to Muslims and refugees after USinfo-icon President Donald Trumpinfo-icon's controversial immigration ban Friday sparked travelinfo-icon chaos and outrage around the worldinfo-icon.

Canada will offer temporary residence permits to people stranded in the country as a result of Trump's order, the immigration ministry said Sunday.

Immigration Minister Ahmed Hussen, who is of Somali origin, did not condemn the US measure but stressed that Canada would continue to pursue an immigration policy based on "compassion" while at the same time protecting the security of its citizens.

"We welcome those fleeing persecution, terror and warinfo-icon," he said, echoing a welcoming Twitter post by Prime Minister Justin Trudeau on Saturday.According to the latest Canadian census, from 2011, one out of five people in the country are foreign-born.

Canada has welcomed more than 39,670 Syrian refugees between November 2015 and early January 2017, according to government figures.