QUEBEC CITY • In a world often hostile to migration, Canada has stood out, welcoming refugees fleeing war and seeking a haven. It has been a feel-good time for Canada, proud of its national tolerance.
On Sunday, that was upended when a man walked into Quebec City's mosque and started shooting, killing six people and seriously wounding five others. The alleged gunman, 27-year-old Alexandre Bissonnette, was charged on Monday with six counts of murder.
The nation quickly rallied after the attack. Prime Minister Justin Trudeau called it an act of terrorism, and there was a collective outpouring of remorse and empathy.
But the attack also forced Canadians to confront growing intolerance and extremism that have taken root, particularly among some people in this French-speaking corner of the country.
It was also a wrenching event for a country not accustomed to mass killings and even less used to the acrimonious immigration debate that has echoed from across the United States. Before Sunday, many Canadians were watching the immigration ban introduced by US President Donald Trump with fascination and, for the most part, disgust.
Yet, the killings are a tear in the fabric of a nation in transformation, where about one million of its population of 35 million are Muslims.
Sunday's shooting is not the deadliest terrorist attack that Canada has seen.
1970: A Quebec minister was strangled and left in a car boot. His killers were home-grown terrorists who had bombed the Montreal Stock Exchange a year earlier.
1984: A bomb exploded in Quebec City's main railway station, killing three and wounding 41. The bomber was protesting against a planned visit by the Pope.
1985: An Air India flight from Vancouver exploded in mid-air, killing all 329 people on board. The attack was in retaliation for a raid on a Sikh temple in India.
2014: Two soldiers were killed within days of each other. In the first attack, the victim was run down in a Quebec carpark. In the second, a man shot an honour guard, then entered the Parliament building and continued firing.
"Canada took in roughly 30,000 Syrian refugees in a three-month period - proportionate to the US taking in 225,000 over that time," said Mr David Harris, a lawyer and a director at Insignis Strategic Research, a counterterrorism consultancy. "These are dramatic developments in the life of any nation."
The shooting was the first time anyone was killed in a mosque in Canada in such circumstances and was, at least in recent times, a rare event outside the Muslim world.
Yet, Quebec has a history of confrontations with the Muslim community. In 2005, the province became the first to explicitly ban the use of Syariah law and, less than a decade later, the provincial government tried to pass a "charter of values" that would have banned provincial employees from wearing Muslim headscarves and other "overt" religious symbols.
Quebec City, home to some 7,000 Muslims, is a conservative bastion within the province and home to right-leaning radio talk shows that push an anti-Islam agenda - unusual for Canadian broadcasters.
Mr Mohammed Amin, who is in charge of social activities at the attacked mosque, said the community had a "cordial relationship" with its neighbours.
But other leaders at the mosque said there have been hate letters and swastikas painted on its door, episodes that led to the installation of eight security cameras.
"Certainly Islamophobia has been increasing for some time," said Mr Samer Majzoub, president of the Canadian Muslim Forum.
Ms Lise Lavary, a columnist for tabloid Journal de Montreal, said it may be time for the debate to calm down.
"I am a very vocal opponent of Islamism, and I realise now that whenever I condemn ISIS (Islamic State in Iraq and Syria), a lot of people view this as me condemning every Muslim on earth," she said.
"Self-censorship looms for the common good."