A Canadian man accused of being an al-Qaeda sleeper agent has vowed to challenge a court ruling that could see him deported to his native Algeria.
Mohamed Harkat told reporters he would be in danger there because Canada had dubbed him a terrorist.
His remarks came a day after a federal court found the former pizza delivery man a national security threat.
Mr Harkat's movement has been limited under strict bail conditions, under a rarely used national security law.
Lawyers for Mr Harkat told Canadian media he was devastated by the latest ruling and planned to appeal.
On Thursday, federal court Judge Simon Noel rejected Mr Harkat's bid to have the "national security certificate" quashed and his bail conditions lifted.
Relying on closed court proceedings, Judge Noel found that Mr Harkat had links to terrorist groups in Chechnya, Egypt and Pakistan.
Mr Harkat, 42, "maintained contacts and assisted Islamist extremists, and used some methodologies typical of a 'sleeper agent'," Judge Noel wrote.
"There are reasonable grounds to believe Mohamed Harkat has engaged in terrorism, is a danger to the security of Canada and is a member of the Bin Laden Network."
Judge Noel wrote that Mr Harkat's defence had been inconsistent and "simply incoherent, implausible if not contradictory", and concluded that he posed a threat to Canada.
Canadian intelligence officials say Mr Harkat had ties to an Islamist terror group, operating a guesthouse in Pakistan for them before coming to Canada in 1995 on a forged Saudi passport.
In 2002, Canadian justice and immigration officials declared Mr Harkat inadmissible to Canada and said he was a security threat.
He was arrested and jailed for nearly four years, and since 2006 has been under virtual house arrest in the Ottawa area.
Canadian law permits the authorities to issue a national security certificate allowing the government to detain and deport non-citizens on security grounds without revealing all the evidence, according to the Canadian Broadcasting Corporation.