A couple places flowers near a mosque in Quebec City on Monday where a Sunday night shooting left multiple people dead. (Paul Chiasson/AP)

Canadian authorities on Monday charged a 27-year-old university student known for his far-right sympathies with six counts of first-degree murder in a mass shooting the day before at a local mosque.

Alexandre Bissonnette, described by neighbors and acquaintances as a socially awkward introvert who had recently adopted virulent political views, was also charged late Monday afternoon with five counts of attempted murder with a restricted firearm. The five surviving victims were still in the hospital, with two of them in critical condition, although hospital officials said their injuries were not life-threatening.

Handcuffed, his feet manacled and wearing a white prison jumpsuit, Bissonnette reportedly looked at the floor throughout the court hearing, aside from casting a brief glance at his lawyer. The prosecutor, Thomas Jacques, indicated that terrorist charges could be added later to the murder and attempted murder charges.

The attack, which took place just as about 50 worshipers at the small mosque in the suburb of Sainte-Foy near Laval University had completed evening prayer, sent shock waves through Canada. Accustomed to seeing violence as a phenomenon taking place in the United States, Europe and the Middle East, Canadians found themselves in the headlines for all the wrong reasons.

Prime Minister Justin Trudeau was clear that his government considered the shooting a terrorist act. “This was a group of innocents targeted for practicing their faith,” Trudeau told the House of Commons. “Make no mistake. This was a terrorist attack.”

Alexandre Bissonnette, the suspect in the shootings at a Quebec City mosque, is seen in a Facebook posting. (Reuters)

“These were people of faith and of community,” he said. “And in the blink of an eye, they were robbed of their lives in an act of brutal violence.”

Bissonnette was described in media reports as an ardent nationalist and a strong supporter of the French far-right politician Marine Le Pen. He was known to activists in Quebec for taking positions against feminism and refugees, said François Deschamps, of the pro-refugee group Bienvenues aux Refugiés, on his Facebook page.

The suspect was captured by police about 15 miles from the scene of the attack after he called 911 and offered to surrender. The police initially said they had also arrested a 29-year-old engineering student at the Quebec Islamic Cultural Center. By Monday afternoon, they released him and called him a witness to the event.

It turned out the witness, Mohamed Belkhadir, had left the mosque at the end of prayers and was near the building when he heard shots. Returning inside, he called 911 and began helping a friend who had been shot. When he saw armed police arrive, he panicked and ran off and was quickly stopped. He said the police had treated him well.

On Rue du Tracel, a quiet crescent of modest houses in suburban Cap-Rouge about a 15-minute drive from the mosque, Rejean Bussieres knew something was up when several police cars descended on his street Monday morning. Having heard of the shooting, he said, he immediately thought it could be Bissonnette.

“He used to like to break things as a kid,” said Bussieres, who has been a neighbor of the family for 30 years. “He was turbulent.”

Bussieres, a retired municipal blue-collar worker, said that Bissonnette and his twin brother Mathieu were always introverted.

Bussieres’s 23-year-old daughter, Rosalie, said the twins had reputations as “nerds” who were obsessed with violent computer games and were bullied at school. “They were always just with each other. It’s sad. They were always home alone.”

According to Toronto’s Globe and Mail website, Vincent Boissoneault, a friend of the suspect’s who also studied at Laval University, said that Bissonnette had been uninterested in politics until Le Pen visited Quebec City last year. Soon Boissoneault was clashing with his friend over his support for Le Pen and Trump.

“I wrote him off as a xenophobe,” Boissoneault told the newspaper. “I didn’t even think of him as totally racist, but he was enthralled by a borderline racist nationalist movement.”

But the Globe and Mail also quoted friends from Bissonnette’s days in junior college as saying he was apolitical and more interested in chess than right-wing politics.

While mosques in Canada and the United States have been the targets of vandalism and other hate crimes in recent years, the Quebec City attack appears to be one of the first mass shootings at an Islamic house of worship in North America.

Jack Jedwab, president of the Association for Canadian Studies, whose research is focused on Canadian attitudes toward immigrants and religious minorities, said that the far right is a marginal movement in Quebec but that it does not stop “unstable people” from being attracted to its propaganda.

He told The Washington Post that Bissonnette was “clearly a person with problems” who was drawn to far-right ideology.

But Jedwab noted that there were no prominent elected politicians in Quebec who backed far-right positions, and he praised Trudeau and other leading Canadian politicians for reaffirming the government’s position of openness and support for the acceptance of Syrian refugees.

Jedwab said he did not link the attack to Trump’s election win or his ban on refugees and visitors from several Muslim-majority countries last week. “I don’t think this was planned in 24 hours. This was planned over a period of time,” he said, noting that Canadian firearm laws make it difficult to procure weapons in short order.

The attack is a particular shock for Quebec City, a prosperous city of 800,000 that prefers to be known for its winter carnival and charming Latin Quarter. Unlike the multicultural centers of Vancouver, Toronto and Montreal, Quebec City remains overwhelmingly white, Catholic and French Canadian.

Nevertheless, the city has seen recent growth in its Muslim population, particularly immigrants from French-speaking North and sub-Saharan Africa. The mosque located a short distance from the university was a microcosm of that growing community.

Among the victims identified by the Quebec coroner late Monday was Azzediene Soufiane, a ­57-year butcher, whose halal meat market and grocery story was shut on Monday afternoon, a few forlorn bouquets left at the front door.

“He was nice, social and well-liked by his customers,” Amine Noui, a longtime friend of Soufiane, told Radio-Canada, the French service of the Canadian Broadcasting Corp. Noui said it was Moroccan-born Soufiane who was one of the first people to lend him a helping hand when he moved to the community a decade ago.

Khaled Belkacemi, another victim, was an Algerian-born professor at Laval whose work focused on “green” chemistry and functional foods. Calling it “horrible news,” university rector Denis Briere said Belkacemi was a colleague who would be greatly missed.

Two of the remaining victims were from Guinea. Both were married and leave a total of six children. The other victims were born in Tunisia and also had young families.

Bever and Hawkins reported from Washington. Marissa Miller in Quebec City contributed to this report.