Richelieu, Quebec: Canadian police said on Tuesday they had arrested a suspected militant as he was leaving the country, took away his passport and talked to him several times but had no chance of preventing him from killing a soldier.

Martin Rouleau, a 25-year-old who converted to Islam last year, rammed his car into two soldiers in the Quebec town of Saint-Jean-sur-Richelieu on Monday and was shot dead by police.

A 53-year-old adjutant died in the attack.

The incident, the first fatal attack on Canadian soil tied to Islamic militants, occurred after Canada announced this month it was joining the battle against Islamic State fighters who have taken over parts of Iraq and Syria.

Rouleau was among 90 people being tracked by the Royal Canadian Mounted Police (RCMP) on suspicion of taking part in militant activities abroad or planning to do so.

Martine Fontaine, the RCMP official who is responsible for national security matters in Quebec, said police had never come up with enough evidence to lay charges against Rouleau and could not have predicted the attack.

"We can't arrest somebody for having radical thoughts. It's not a crime in Canada," she told a news conference in Montreal.

"It was very difficult to prevent and stop him. Even if he had been under surveillance yesterday morning, we didn't know of his intention to use his car as a weapon," she said.

Fontaine said police had become aware of Rouleau in June when they studied his Facebook site and concluded he was becoming radicalised and wanted to leave Canada to fight abroad.

As Rouleau was about to fly to Turkey in July, police arrested him on grounds that he might be about to commit an act of terror abroad.

"We had reasons to stop him," Fontaine said, adding that police never could come up with enough evidence that he intended to commit a crime either in Canada or abroad.

The RCMP took away his passport to use as evidence and then met him several times in a bid to persuade him to change his ways. Police said that at their last meeting on Oct. 9 he gave them some reason to believe he would modify his behavior, so they stopped their surveillance.

Canadian security officials have worried for years about the threat of radicalized young men, and the concern became more intense after Canada sent six fighter jets to take part in the campaign against Islamic State militants in Iraq. Ottawa uses the term radicalized to refer to those who support militant Islam.

"What took place yesterday is clearly linked to terrorist ideology," federal Public Safety Minister Steven Blaney told reporters in Saint-Jean-sur-Richelieu.

The government said on Tuesday it had raised its terrorism threat level to medium from low because of a rise in "general chatter" from radical Islamist groups such as Islamic State and Al Qaeda, and not because of a specific threat.

The Canadian Security Intelligence Service (CSIS) spy agency says it is aware of at least 50 Canadians involved in terrorist-related activities with Islamic State and other militant groups in the Middle East.

The government said last week it planned to boost the powers of CSIS to track potential militants when they travel abroad.

Red flags

Rouleau's Facebook and Twitter accounts, which media reports said he ran under the name Ahmad Rouleau, show he converted to Islam in 2013 and became increasingly political in April 2014.

According to legal documents, his full name is Martin Couture-Rouleau, though police gave his name as Rouleau-Couture on Tuesday.

The entries on Ahmad Rouleau's Facebook page promote Islam as the true religion and Christianity and atheism as false, and some posts have a political tone.

Amarnath Amarasingam, a researcher at Dalhousie University in Halifax, Nova Scotia who studies the foreign fighter phenomenon, said he had been following Rouleau on social media for about six months.

Amarasingam said Rouleau was quoting the Koran in November 2013, indicating he had converted by then. He began referring to "hypocrites" in April, which Amarasingam said typically refers to Western Muslims who have compromised to fit in and not undertaken an attack on the West.

Efforts by Reuters to talk to Rouleau's father and other members of his family were unsuccessful.

The father told television network TVA that he last saw his son Monday morning and did not notice any difference in his behavior. "If I had sensed that there was any danger, I would have saved him," he said.