Mohamed Harkat, an Ottawa-based man accused of being an al-Qaeda collaborator and detained on a federal security certificate from 2002 until 2006, is being freed from jail but will remain under house arrest until his next hearing.

Federal authorities swooped down on Harkat on Tuesday and arrested him in the shower for allegedly violating strict bail conditions imposed in 2006 when he was released after 3½ years in jail under the security certificate.

In a ruling Friday, Federal Court Justice Eleanor Dawson said Harkat, an Algerian refugee, must stay inside his Ottawa residence until a court proceeding Monday.

Lawyers argued for hours Thursday over whether a change in Harkat's living arrangements amounted to a breach of bail terms set by the court.

One of the conditions of his bail was that he live in the same house as his wife and mother-in-law.

Government lawyers claim Harkat breached bail conditions because his mother-in-law, Pierrette Brunette, is no longer a full-time resident of the house where Harkat and his wife, Sophie, live in a basement apartment.

Matt Webber, counsel for Harkat, said the sudden arrest was unnecessary because his client's behaviour had been impeccable.

Harkat was first arrested on a security certificate in 2002 and accused by the Canadian Security Intelligence Service (CSIS) of being an agent for an al-Qaeda sleeper cell.

The controversial certificates allowed authorities to hold suspects indefinitely without trial and keep evidence against them secret.

While their use was deemed unconstitutional by the Supreme Court in February 2007, Ottawa has been permitted to continue to hold five suspected terrorists arrested on the certificates while it works on a new law. A bill proposing a new system was tabled in the fall.