Article content continued

Noting that Mr. Malik had allegedly planned a “terrorist attack on facilities here in Toronto,” IRB member Marilou Funston ordered him detained in the Lindsay, Ont., jail, while the CBSA continues its investigation.

Mr. Malik has not been charged with terrorism offences. Rather, the CBSA is preparing to deport him on the grounds he is a threat to security. While Mr. Malik is a landed immigrant, he is not a Canadian citizen.

The planning was elaborate, including discussing with the undercover officer the video message they would leave behind in order to inspire others

Anser Farooq, his lawyer, said if Mr. Malik had done what the authorities have alleged, he should be charged, not sent back to Pakistan. “Why wouldn’t you prosecute this guy and give him life? I don’t think this is the right way to do it.”

The hearing at which the shocking allegations were disclosed was witnessed by only two reporters. It offered a rare glimpse of the tactics police are using to address Canada’s growing extremism problem — in this case a six-month undercover operation.

The Ontario Integrated National Security Enforcement Team began its investigation last September. The undercover officer contacted Mr. Malik, a flooring contractor, about installing hardwood floors in his house, the CBSA said.

After befriending Mr. Malik, the officer claimed he was Bosnian and had participated in the Balkans civil war. They talked about religion and according to the CBSA, Mr. Malik said he supported al-Qaida and ISIS, the Islamic State of Iraq and al-Sham.

He also confided that he had attended camps in Libya, where he learned “combat, weapons and land-mine training,” Ms. Lourenco said. He said fighting jihad was “righteous” and that those who died doing so were “martyrs.”