Canadian prime minister Justin Trudeau did not hesitate in calling Alexandre Bissonnette a "terrorist" after the 27-year-old university student entered a Quebec mosque and murdered six people, injuring many others, with what appeared to be an AK-47.

Prosecutors are trying to figure out the specific motives of Bissonnette, studying political science and anthropology at Laval University, who was detained by police soon after the killings.

But testimony from those who knew him suggest chess-playing twin Bissonnette was a loner who prowled social media spewing "extreme" right-wing views akin to those in the Donald Trump-loving alt-right movement.

Éric Debroise, who knew Bissonnette, told The Quebec Journal that in recent months he had cut friends off and stopped replying to messages.

"He liked Trump a lot and had a permanent discontent with the left," Debroise said, adding that Bissonnette had views which were "very right and ultra-nationalist white-supremacist". He was also described as having strongly pro-Israel and anti-immigration views, though never suggested he would turn violent.

Bissonnette apparently became politically energised by a visit to Quebec from Marine Le Pen, the French far-right politician and leader of the Front National party, for which she is standing to be the next president of France in the 2017 elections.

"I keep wondering who defends Quebec identity, who defends sovereignty, the right of the people to express themselves freely," Le Pen told a Quebec radio station during her March 2016 visit.

Activists using the Refugees are Welcome in Quebec City group on Facebook were familiar with Bissonnette. A message posted by administrators of the Facebook group said it is "with pain and anger that we learn the identity of the terrorist Alexandre Bissonnette, unfortunately known to several activists in Quebec City for [his] identity positions, pro-Le Pen and anti-feminists [at] Laval University and on social networks."

Alexandre Bissonnette
Alexandre Bissonnette Facebook/Alexandre Bissonnette

On his own Facebook profile, Bissonnette liked an eclectic mix of fan pages: from pop star Katy Perry, to German industrial metal band Rammstein, to Marine Le Pen and Donald Trump. Another person who knew him said he was only ever seen with his twin brother, or at the family home, and was "unpopular" and a "typical nerd" often bullied by others.

"I wrote him off as a xenophobe," a university classmate, Vincent Boissoneault, told The Globe and Mail. "I didn't even think of him as totally racist, but he was enthralled by a borderline racist nationalist movement."

Boissoneault added: "He was someone who made frequent extreme comments in social media denigrating refugees and feminism. It wasn't outright hate, rather part of this new nationalist conservative identity movement that is more intolerant than hateful."

According to a report in Le Soleil, Bissonnette called the police after carrying out his attack to confess, claiming he felt bad about it and was considering shooting himself. But he eventually said he wanted to be taken in by police. He has been charged by police with six counts of first-degree murder and five of attempted murder.