Canadian authorities apparently regarded Ahmed Ressam as nothing more than a nuisance until a surprising discovery was made when he tried to cross through a US border post.
From the time he entered Canada in early 1994, Ressam had operated on the outer fringes of his adopted country. But there was nothing so serious that the Government felt the need to take drastic action against him.
Looking back it seems bizarre. But Canada's treatment of Ressam was akin to a sort of casual bureaucratic bumbling.
He arrived from his native Algeria with a forged French passport and asked for refugee status. He admitted he had spent time in an Algerian prison for arms dealing. Immigration staff took his fingerprints and released him. Within months he was arrested for picking pockets of elderly women in Montreal. Then he was arrested for stealing luggage at Vancouver airport.
His claim for refugee status was rejected because he did not show up for his hearing. However, Ressam was released on condition that he report regularly to immigration officials. He ignored that order as well.
Ressam managed to get himself a Canadian passport with a forged baptismal certificate and a fake student identity card.
That gave him a social insurance card by virtue of which he obtained a driver's licence.
Throughout most of this period he was living off government welfare payments that nobody thought to challenge.
And, perhaps most puzzling of all, since 1996 Ressam had been under surveillance by Canada's security agency because he was associating with known Islamic extremists. And to cap that, there were wiretaps proving he had undertaken terrorist training abroad.
Yet nothing was done about Ressam, then also known as Benni Noris, until he was crossing from Vancouver Island to Port Angeles in the US state of Washington.
A United States customs official thought it was odd that when she asked Ressam for identification he produced a membership card from a wholesale supermarket store. She decided to take a look in the boot of Ressam's rented car. When she found it filled with explosives and detonating devices, Ressam fled and tried to hijack a car, but was arrested.
That was in December 1999. Ressam had been headed south to mark the millennium with a massive explosion at the Los Angeles international airport, investigators say.
Since then, after hours of interrogation and two trials, investigators have assembled the evidence that points to an impressively large terrorist organisation that was operating under the noses of Canadian authorities.
The 33-year-old Ressam was convicted on nine charges and sentenced to between 55 and 130 years in prison. In the hope of a lighter sentence, he is now testifying in a New York court against a former collaborator.
Every day of his testimony must be embarrassing for Canadian officials and their security apparatus who seemed almost unconcerned about an Islamic guerilla suspect in their midst.
In almost a year of terrorist training in Afghanistan Ressam learned how to mix oil and cyanide to be painted on doorknobs in the hope of poisoning anyone who touched them. He watched caged dogs die as part of a lesson in putting cyanide into a building's ventilation system.
He and an associate discussed blowing up a neighbourhood in Canada 'where there was an Israeli interest', although it was not clear where that would be or how far the planning progressed. His associate in that plan had been involved in a 1992 bomb attack on Algiers airport.
Although the Ressam experience has shaken Canadian authorities, they could not have been surprised. The Canadian Security and Intelligence Service warned again this month of the emergence of North America as a target for terrorism.
'A hardening attitude and willingness on the part of certain terrorist organisations to support terrorist operations in North America reinforce the belief that Canadians, now more than ever, are potential victims and Canada a potential venue for terrorist attacks,' the agency said.
A former senior official with the agency, David Harris, was even more blunt in his warning about Islamic terrorists. Canada, he said, 'is just a big jihad [holy war] aircraft carrier at their service for launching strikes' against the United States.