He is the type of terrorist the government has been warning about: a fanatic who returned from a war zone with bomb-making skills and a plan to set off explosions in Canada.
Yet Hiva Alizadeh, a 34-year-old living in Ottawa and trained in Afghanistan, never got a chance to execute his plan. The scheme had involved 56 detonation devices he'd built with instruction from Taliban-aligned fighters and smuggled into Canada.
"If Allah wills, we will break their backs in their own country," he was caught saying in Ottawa, on a wiretap, before his 2010 arrest.
Such evidence was kept secret until Wednesday, when Mr. Alizadeh – who had sworn an oath to al-Qaeda – entered a surprise guilty plea to terrorism charges in an Ottawa court. The plea got him a 24-year sentence and, for the first time, revealed the alarming details behind the case.
Just metres from that courtroom, counterterrorism officials and politicians in the federal government have been brainstorming ways to contain the threat posed by a new generation of extremists.
More than 130 Canadians are feared to have joined terrorist causes abroad – with dozens flocking to Islamic State (IS), the notorious group in Syria and Iraq that is beheading its adversaries and urging its supporters to explode pipe bombs in North American cities.
IS didn't exist in its current form when Mr. Alizadeh was arrested four years ago. Now that the militants claim to have established a caliphate for all hard-line Muslims, government officials are manoeuvring to prevent any more Canadian sympathizers from boarding overseas flights, and struggling to figure out what to do with any battle-hardened veterans who come back.
Experts say that Canada and other Western nations can expect to see more threats like the one represented by Mr. Alizadeh in the years to come.
"You will see more of this. And you are going to see an [IS] driven attack in the West. Guaranteed, without a doubt, inevitable," said Mubin Shaikh, a former Canadian security-intelligence operative, who famously infiltrated a terrorist cell in Toronto in 2006.
The Alizadeh case shows that Canadian counterterrorism officials do have the capacity to stop terrorist plots in their tracks – even ones involving determined and secretive suspects.
"You have effectively been convicted of treason," Justice Colin McKinnon said as he handed down the sentence Wednesday in Ontario Superior Court. Thanking Canadian counterterrorism officials as "dedicated guardians of the peace," he told Mr. Alizadeh that embracing "radical Islamist jihadist ideology," had "ruined your life and those closest to you."
A naturalized Canadian citizen who had been on welfare before his arrest, Mr. Alizadeh was living with his wife and two young children.
A court-filed agreed statement of facts shows he had been reading a tract called "How to Kidnap Americans" and had possessed some beheading videos. Canadian authorities somehow managed to lock onto him, even as he used pay-as-you-go "burner" phones and public-library Internet connections to disguise his communications.
Police discovered that in 2009, he had flown from Canada to his native Iran, where he sneaked into Afghanistan. He attended a terrorist training camp, and learned how to fire guns and build bombs.
When he returned to Canada two months later, he brought back "56 customized circuit boards" that would require only minor adaptations to be turned into the triggers of cellphone-detonated bombs. He placed the devices in a plastic President's Choice shopping bag, where they stayed in a closet with his stashes of jihadist propaganda, until the RCMP switched the circuitry with inert devices during a covert entry of his apartment.
Police say Mr. Alizadeh communicated with terrorist suspects in Afghanistan and Iran as he tried to assemble his own cell in Ottawa. He was overheard telling his fellow Canadians that he could arrange for their own overseas training. One of his two co-accused has since been convicted. The other suspect – a former Canadian Idol contestant – was acquitted this year.
Mr. Shaikh pointed out that IS has shown it has pockets of support in Canada, including sympathizers who are being blocked from travelling, and that the group in Iraq is vowing to have its sympathizers avenge U.S. air strikes.
"Never mind people who have gone there and joined up," said Mr. Shaikh. "What about people who can't go, but who really, really, really want to go? [IS tells them] the next best thing is 'you know what you can do back home …'"