Six people were killed and eight were injured in a shooting at a Quebec City mosque during evening prayers.

Two arrests were made in what Canada's prime minister called an act of terrorism.

Quebec provincial police spokeswoman Christine Coulombe said early on Monday some of the wounded were gravely injured.

She said the dead were approximately 35 to 70 years of age.

Thirty-nine people were unharmed. More than 50 were at the mosque at the time of the attack.

One suspect was arrested at the scene and another nearby in d'Orleans, Quebec.

Police do not believe there are other suspects. They did not release names of the two.

"The Muslim community was the target of this murderous attack," Quebec premier Philippe Couillard said at an early morning press conference on Monday.

Mr Couillard said there will be solidarity rallies across Quebec on Monday and says the province's people will all be together to express horror.

Quebec City mayor Regis Labeaume appeared visibly shaken.

"No person should have to pay with their life, for their race, their colour, their sexual orientation or their religious beliefs," Mr Labeaume said.

Quebec City Islamic Cultural Centre President Mohamed Yangui said the shooting in the provincial capital happened in the men's section of the mosque.

He said he was not at the centre when the attack occurred, but he got some details from people on the scene.

"We are sad for the families," he said.

Ali Hamadi said he left the mosque a few minutes before the shooting.

He said his friend and co-worker Abdelkrim Hassen, who worked in IT for the government, was killed.

He said Mr Hassen has three daughters and a wife.

He got the neighbour to bring the wife to the hospital so she could hear the news.

She asked, "was he badly hurt?"

He said he had to tell her he was dead.

Canada's prime minister Justin Trudeau and Mr Couillard both characterised the attack as a terrorist act, which came amid heightened tensions worldwide over US president Donald Trump's travel ban on certain Muslim countries.

"We condemn this terrorist attack on Muslims in a centre of worship and refuge," Mr Trudeau said in a statement.

"It is heart-wrenching to see such senseless violence.

"Diversity is our strength, and religious tolerance is a value that we, as Canadians, hold dear.

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

"Canadian law enforcement agencies will protect the rights of all Canadians, and will make every effort to apprehend the perpetrators of this act and all acts of intolerance."

Quebec City police spokesman Constable Pierre Poirier said two suspects were arrested.

Police said the mosque had been evacuated and the situation was under control.

Mr Trudeau had earlier reacted to Mr Trump's visa ban for people from some Muslim-majority countries by tweeting on Saturday: "To those fleeing persecution, terror & war, Canadians will welcome you, regardless of your faith. Diversity is our strength #WelcomeToCanada."

Mr Trudeau also posted a picture of him greeting a Syrian child at Toronto's airport in late 2015.

Mr Trudeau oversaw the arrival of more than 39,000 Syrian refugees soon after he was elected.

The mayor of Gatineau, Quebec, near Canada's capital of Ottawa, said there would be an increased police presence at mosques around his city following the attack.

The New York Police Department said it was stepping up patrols at mosques and other houses of worship "NYPD is providing additional protection for mosques in the city. All New Yorkers should be vigilant. If you see something, say something," New York City mayor Bill de Blasio said on Twitter.

"Our prayers tonight are with the people of Quebec City as they deal with a terrible attack on a mosque. We must stand together," Mr De Blasio said in another tweet.

Canada's public safety minister, Ralph Goodale, said on Twitter on Sunday that he was deeply saddened by the loss of life.

His office said no motive had been confirmed.

In the summer of 2016 a pig's head was left on the doorstep of the Quebec Islamic Cultural Centre.

The incident occurred in the middle of Ramadan.

Francois Deschamps, an organiser of a refugee-support group in Quebec City, said the motive for Sunday's attack is unknown, but right-wing groups are very organised in Quebec City, distribute fliers at the university and plaster stickers around town.

Mr Deschamps said he has received death threats after starting a refugee support group on Facebook and people have posted his address online.

"I'm not very surprised about the event," Mr Deschamps said.

Canada is generally very welcoming toward immigrants and all religions, but it is less so in the French-speaking province of Quebec which has had a long-simmering debate about race and religious accommodation.

A few years ago Quebecers debated a "charter of values" under the previous separatist government, which called for a ban of ostentatious religious symbols such as the hijab in public institutions.