Gradually, tentatively, the country is groping its way back to sanity. Yesterday in Toronto, a judge ruled it didn't make any sense to keep a sick, 46-year-old man who has not been charged with any crime locked up for almost seven years. Meanwhile, in Ottawa, the opposition majority is set to let two of the most odious provisions of Canada's illiberal anti-terror laws – enacted in panic following 9/11 – die a richly deserved death.

We haven't gained our equilibrium yet. Egyptian refugee claimant Mohamed Mahjoub may be able to rejoice now that Federal Court Justice Richard Mosley has allowed him to be detained under house arrest rather than in a special jail built just outside of Kingston. But there are still two other immigrants there who have been imprisoned for years without charge.

And while many Canadians have belatedly discovered the importance of civil liberties when it comes to these so-called security certificate cases, few are championing 20-year-old Omar Khadr, a Canadian citizen currently held against all the norms of international law in George Bush's Guantanamo Bay prison camp.

Which is to say that we have a way to go.

But still, we've made a start. Stéphane Dion's Liberals have acknowledged that they made a gross error in supporting two of the most draconian provisions of the anti-terror laws – the power to jail any citizen without charge and the power to compel individuals, who have not been charged with any crime, to answer police questions.

Unless the Liberals change their minds again, this means that they, along with the New Democrats and Bloc Québécois, will defeat a government motion to extend these two powers past their March 1 expiry date.

This won't solve all of the defects of the anti-terror laws. The legislation continues to give the government sweeping powers to outlaw any organization it wishes – and then treat anyone who has ever been a supporter of such an organization as a terrorist.

The word "terrorist" is defined so broadly that it can include not just those who commit or plan terrorist acts but those who use symbols associated with terrorism.

Wear a Hitler T-shirt and you're all right. Replace that with an Osama bin Laden T-shirt and you court trouble.

All of this is part of the overreaction to 9/11. Those attacks were real. But they also made us crazy. Normally sensible people lost perspective. An atrocity that was, in global terms, run-of-the-mill (9/11 pales beside the Rwandan genocide or, indeed, almost any modern African conflict) was treated as world defining. Terrorism, a dirty little crime that is neither new nor glamorous, was accorded a status it did not deserve.

Understandably, the Americans were most affected by this frenzy. They are only now beginning to untangle the cost of what happens when a great power loses its mind.

In Canada, as always, the stakes were lower, the reaction more muted, the irrationality couched in bureaucratese. We had our anti-terror laws but, until recently, didn't much use them.

Instead, the Canadian government preferred a section of the immigration act that allowed it to scoop up non-citizens and hold them indefinitely.

A legal provision designed for spies (it was used successfully last year to arrest and deport a Russian intelligence agent), it made no sense when applied to terrorism.

Mahjoub's case illustrates the point. It is easy to see why the Canadian security services were wary of him. He once worked for a Bin Laden agricultural company; he knew two others believed to be connected to Al Qaeda and then lied about knowing them.

But apparently Mahjoub is not a terrorist. If he were, the RCMP would have charged him. Rather, he is someone the government, for reasons it will not divulge publicly, does not want here.

Perhaps the government's reasons are good ones. Who knows? It offers us no evidence.

What we do know (and various judges have affirmed this) is that if he is returned to Egypt he risks torture. So, except in the most extreme case, we can't send him there. The Supreme Court has been clear on this.

Nor can we keep him locked up indefinitely without charge. That's almost certainly unconstitutional.

In the end, something else has to be done with the Mohamed Mahjoubs of this world. The Supreme Court, which is due to rule soon on the entire security certificate question, may provide an answer.

Until then, Mahjoub gets some relief. He gets to wear an ankle bracelet, see his family, walk in his back yard during daylight hours and not be in jail. It may not be the final answer, but it is a step on the road to sanity. For him. For us.