The university student charged with killing six Muslim men during evening prayers at a mosque in Canada was known for far-right, nationalist views and his support of the French rightist party led by Marine Le Pen.

Alexandre Bissonnette was charged with six counts of first-degree murder and five counts of attempted murder over the shooting rampage at a Quebec City mosque that Canada's prime minister called an act of terrorism against Muslims.

Bissonnette, a French Canadian student, made a brief court appearance and did not enter a plea over the attack staged during evening prayers on Sunday.

Wearing a white prisoner jump suit, his hands and feet shackled, he stared down at the floor and fidgeted, but did not speak.

The 27-year-old suspect, who has espoused support for Ms Le Pen and US president Donald Trump on his Facebook page, was known to those who monitor extremist groups in Quebec, said Francois Deschamps, an official with a refugee advocacy group.

"It's with pain and anger that we learn the identity of terrorist Alexandre Bissonnette, unfortunately known to many activists in Quebec for taking nationalist, pro-Le Pen and anti-feminist positions at Laval University and on social media," Mr Deschamps wrote on the Facebook page of the group, Bienvenues Aux Refugies, or Welcome To Refugees.

An anthropology and political science major at Laval University in Quebec City, Bissonnette had also expressed support on his Facebook profile for Generation Nationale, a group whose manifesto includes the rejection of "multiculturalism".

Authorities said Bissonnette was unknown to police.

The grandson of a decorated Second World War veteran, Bissonnette appears in a Facebook photo as a boy dressed as an army cadet, a military leadership programme for Canadian youths.

But cadets are not members of the Canadian Armed Forces and do not receive military training.

For Ms Le Pen and her supporters, "massive migration", notably from Muslim North Africa, is supplanting French civilisation and is at the root of many France's modern woes.

"On est chez nous" ("we're in our land") is a mantra at the rallies of her party, the National Front.

Her views have won the endorsement from white supremacists.

More than 50 people were at the Quebec Islamic Cultural Centre when the shooting began, and witnesses described a scene of chaos as worshippers scrambled to find friends and loved ones.

In addition to the six dead, 19 people were wounded - all men.

Of the five victims who remained in hospital, two were in critical condition, authorities said.

The dead ranged in age from 39 to 60.

Canada's prime minister Justin Trudeau and Quebec premier Philippe Couillard both characterised the attack as a terrorist act, which came amid strong criticism around the world over Mr Trump's temporary travel ban for people from seven Muslim countries.

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

The previous separatist government of the province called for a ban on ostentatious religious symbols, such as the hijab, in public institutions.

Mr Trudeau said in Parliament the victims were targeted simply because of their religion.

Speaking directly to the more than one million Muslims who live in Canada, he said: "We are with you."

"Thirty-six million hearts are breaking with yours," Mr Trudeau said.

The prime minister later attended a vigil along with thousands of people wrapped up in winter clothes in front of Notre-Dame-de-Foy Church, just around the corner from the mosque that was attacked.

It was one of many vigils in Canada, and the Eiffel Tower in Paris was darkened in respect to the victims as was the CN Tower in Toronto.

The suspect was arrested in his car on a bridge, after he called 911 to say he wanted to cooperate with police.

Authorities, who initially named two suspects, said the other man taken into custody was a witness to the attack and was released.

Officials said they did not believe there were others involved but were investigating.

Police did not give a motive for the attack.

Mr Trump called Mr Trudeau to express condolences to the Canadian people and to offer any assistance that might be needed.

The White House pointed to the attack as an example of why Mr Trump's policies are needed.

"We condemn this attack in the strongest possible terms.

"It's a terrible reminder of why we must remain vigilant and why the president is taking steps to be pro-active, rather than reactive when it comes to our nation's safety and security," White House spokesman Sean Spicer said.

The victims were businessmen, a university professor and others who had gathered for evening prayers, said Mohamed Labidi, vice president of the mosque.

"'It's a very, very big tragedy for us," Mr Labidi said tearfully. "We have a sadness we cannot express."

He said the victims were shot in the back.

"Security at our mosque was our major, major concern," he said. "But we were caught off guard."

Asked if he blamed recent rhetoric in the US for the attack, the Quebec premier said he would "not go there".

"Quebec is a good, generally loving society, but we have these devils as other societies have. We have to recognise that and fight them," Mr Couillard said at a news conference at which he and Muslim leaders held hands in a display of solidarity.

The mosque has been a target of hate crimes in the past, including last summer when a pig's head was left on its doorstep during Ramadan, when Muslims fast from dawn to sunset.