A shooting at a Quebec mosque during Sunday night prayers which killed six people was a terrorist attack, Canadian Prime Minister Justin Trudeau says.

Key points: Police confirm deaths in shooting but don't give number

Police confirm deaths in shooting but don't give number Witness said about 40 people inside mosque at the time

Witness said about 40 people inside mosque at the time Mosque's president says injured people taken to hospitals across Quebec City

"We condemn this terrorist attack on Muslims in a centre of worship and refuge," Mr 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."

A Quebec police spokesman said six people died in the attack and eight people were injured.

"Six people are confirmed dead — they range in age from 35 to about 70," spokeswoman Christine Coulombe said.

Loading

Police added that two suspects had been arrested, but gave no details about them or what prompted the attack.

A witness said heavily-armed tactical police entered the mosque, but a police spokesman declined to say whether there was a gunman inside.

Earlier, a witness told reporters that up to three gunmen fired on about 40 people inside the Quebec City Islamic Cultural Centre.

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

Mr Yangui, who was not inside the mosque when the shooting occurred, said he got frantic calls from people at evening prayers, and that the injured had been taken to different hospitals across Quebec City.

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

Mosque had been targeted before

Dozens of people were said to be inside the mosque at the time of the shooting. ( Reuters: Mathieu Belanger )

Quebec Premier Philippe Couillard said it was an act of "barbaric violence" and expressed solidarity with victims' families.

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," she said.

"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."

Incidents of Islamophobia have increased in Quebec in recent years amid a political debate over banning the niqab, or Muslim face covering.

In 2013, 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 Paris.

Mr Couillard said there would be solidarity rallies across Quebec on Monday.

Reuters/AP