The shooting was the first time anyone had been killed in a mosque in Canada in such circumstances and was, at least in recent times, a rare event outside the Muslim world. The attack was particularly shocking for Quebec City, where the bulk of the population of 750,000 works for the provincial government, universities or in tourism. Until Sunday there had not been any murders in the city for 21 months.

Mr. Bissonnette was well known to people who monitor far-right groups in Quebec, where he frequently commented on sites speaking about immigration and Islam. He was a particularly vocal supporter of Marine Le Pen, leader of France’s far right, when she visited the city last year.

He was a student of anthropology and political science at Laval University, just minutes from where the shooting took place, according to people who monitored his online activities.

“He was not a leader and was not affiliated with the groups we know,” said François Deschamps, a job counselor at Carrefour Jeunesse, a community organization that helps young people find jobs. Mr. Deschamps, who also runs an online group to help refugees called Bienvenue aux Réfugiés, said he had watched Mr. Bissonnette’s anti-Muslim postings for about a year.

“The minute I saw his picture this morning, I recognized him,” Mr. Deschamps said by telephone, adding that Mr. Bissonnette used his real name online.

Mr. Bissonnette and his family live in Cap-Rouge, a western suburb of Quebec City that lies in the shadow of a towering railroad trestle. Neighbors said there was nothing remarkable about the quiet young man.