A young Quebec man stands accused of murder after a brazen assault on a Quebec City mosque that took the lives of six Muslim worshipers – a violent shooting condemned as "a terrorist attack" by Prime Minister Justin Trudeau that has rattled the country.

As Canadians reeled from the shock of Sunday night's killings, Alexandre Bissonnette, 27, appeared in a Quebec City court late Monday under police guard. He is charged with six counts of murder and five counts of attempted murder. He did not enter a plea on any of the charges.

Mr. Bissonnette's court appearance lasted less than two minutes. Clad in a prison jumpsuit and wearing handcuffs, the slight man kept his eyes downcast and fidgeted nervously but did not look at the crowd. He was remanded into custody until Feb. 21, when he will return to court.

Story continues below advertisement

Crown Attorney Thomas Jacques said the investigation is continuing and more charges could be laid. Mr. Bissonnette's lawyer declined to comment.

Explainer: The Quebec City mosque attack: What we know so far

Read more: Suspect known for right-wing online posts

Related: Quebec City shooting was act of terror against Canada, Trudeau says

His appearance came after an emotional day of reflection by Canadian lawmakers and Muslim community members in the face of one of the country's worst mass killings. There was also early misinformation. After initially saying there were two suspects, police from the Sureté du Québec provincial force confirmed around noon Monday that there was only one and that he was in custody. The other person is being considered a witness.

"Six of our brothers … were murdered [by shots to] the back while they were praying," said Boufeldja Benabdallah, a local Muslim community leader in Quebec City, speaking at a news conference with Quebec politicians. "Please spare a thought for them. For the children and for their wives."

Among the men who died at the Centre Culturel Islamique de Québec was a university professor and a shopkeeper. The six victims had all left their birthplaces to find a better life in Canada. They and 19 others who were injured, five of them seriously, were all men aged 39 to 60, police said. Another 39 people who were in the mosque at the time of the shooting were unharmed.

Story continues below advertisement

Muslim leaders were touched by the show of sympathy and support from across the country in this hour of grief. But they also expressed the need for all Canadians to stand together against intolerance.

"There are no words to express our pain for those we lost," said Mohamed Labidi, vice-president of the Islamic cultural centres in Quebec City. "While these despicable people attacked the fibre of the Muslim community, they also attacked the very fibre of Quebec and Canadian society."

Premier Philippe Couillard and Quebec City Mayor Régis Labeaume were at a loss to explain why such a horrible tragedy had occurred in such a peaceful city.

"This is hitting us like a train," Mr. Labeaume said. "I recently boasted how there had not been a murder here in 21 months and how this was one of the safest cities around. And now this happens. How can this happen here?"

Several thousands asking similar questions braved the cold to gather across the street from the mosque for a multi-faith vigil on Monday evening.

They arrived carrying placards ("Nous sommes tous québécois" – we are all Quebeckers, one said) and candles. They listened to a series of addresses from religious, civic and political leaders.

Story continues below advertisement

Mr. Couillard said "the most eloquent statement of all is being made by your presence here this evening."

Each of the major federal party leaders was on hand and Mr. Trudeau said "Canada is united tonight."

Describing the killings as an "act of cruelty and indescribable violence," Mr. Trudeau said "we stand with you, we love you, we support you."

While vigils were taking place Monday evening, a disquieting portrait emerged of the suspect in the attack. A former cadet, Alexandre Bissonnette was known in the city's activist circles as an Internet troll who frequently took anti-refugee and anti-feminist positions and stood up for U.S. President Donald Trump. But he never openly espoused violence or hatred.

Police searched an apartment linked to Mr. Bissonnette on Monday evening after a separate search earlier in the day of a home owned by his parents in nearby Cap-Rouge. The white and grey two-storey house sits on a small crescent just a few dozen metres from the St. Lawrence River.

Police descended on that site as well as others around Quebec City hunting for information in what they described as a large and unfinished investigation. Surveillance of mosques around Quebec and Ontario has been stepped up.

Story continues below advertisement

Details of the shooting itself remained imprecise. Worshippers were at Quebec City's mosque for the evening prayers Sunday when the attack occurred. Frantic worshippers started calling 911 at 7:55 p.m., according to police.

One witness, who did not want to give his name, said he was in the mosque after the prayer when a man walked in and started shooting "everything" that moved.

"It was someone who mastered weapons because it was calm," the man said. "He killed and he killed."

The witness said he lay on his stomach near the front of the mosque as the man emptied his weapon. Then, he said, the gunman just stopped and left.

Police said they intercepted one of the men initially labelled a suspect near the mosque shortly after receiving the first emergency phone calls and arrested him. He is believed to have been trying to help victims, not hurt them.

The other man, allegedly Mr. Bissonnette, fled the scene by car and called 911 around 8:10 p.m. to say he was involved. He stopped his vehicle on the ramp leading to the Île d'Orléans bridge to wait for police, authorities said.

Story continues below advertisement

Quebec's Integrated National Security Enforcement Team, consisting of investigators from the RCMP, the Sûreté du Québec and the Montreal police service, took over the investigation around 10 p.m. Sunday when the shooting was determined to be an act of terror.

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

Condemnations poured in from around the world as word of the attack spread. New York Mayor Bill de Blasio announced the New York City Police Department was beefing up security around mosques and said New Yorkers should be vigilant.