On Monday the Modern Spies programme substantiated an extraordinary allegation that suggested how far the war on terror has descended into legal abyss. The claim was that MI6 rolled the pitch for Tony Blair's bizarre 2004 hug-in with Libya's Colonel Gaddafi by apparently arranging for the CIA to kidnap Gaddafi's opponent in exile, Abdel Hakim Belhaj. He was seized in Bangkok, where he and his wife were en route to Britain. It's been suggested they were "rendered" via the British colony of Diego Garcia to Tajoura jail in Tripoli. Belhaj spent six years, and his wife four and a half months, at the tender mercies of Gaddafi's security boss, Moussa Koussa. Belhaj's pregnant wife was taped like a mummy on a stretcher, and he was systematically tortured. Koussa himself denies any involvement in torture.

With this gift came a covering letter from MI6's Mark Allen, offering Koussa congratulations on the "safe arrival" of the "air cargo [Belhaj]. This was the least we could do for you and for Libya to demonstrate the remarkable relationship we have built over the years." Within two weeks Gaddafi was welcoming a fawning Blair in his famous desert tent, and announcing that he would abjure terrorism and set aside his "planned" weapons of mass destruction. The plans were spurious, but the deal allowed Blair to walk tall in Washington at a time when the Iraq invasion was turning sour.

Less spurious were other elements in the strange relationship. It was claimed Britain would not just deliver Belhaj but lift sanctions. Gaddafi would greet BP's Lord Browne, accompanied by Allen, who switched with full ministerial approval from being an MI6 officer to a £200,000 special adviser to BP. When, three years later, the £15bn deal with BP seemed to falter, it's claimed Allen pressed his old boss, Jack Straw, to release Libya's Lockerbie bomber, Abdelbaset al-Megrahi. Allen was a senior adviser to Monitor consultancy, which helped boost Gaddafi's world image, and assisted the London School of Economics, on whose advisory board Allen sat and where Gaddafi's son Saif was receiving a much-heralded PhD. The new chairman of BP was none other than Sir Peter Sutherland, also chairman of the LSE.

When, in 2011, Gaddafi's regime was visibly tottering, Britain coolly deserted him. Sanctions were reimposed, but no one thought to tell Nato special forces, present at the fall of Tripoli, to find and secure the building in which the incriminating documents lay. Presumably to the horror of MI6, Human Rights Watch got there first and found Allen's letter, which was handed to journalists. To make things worse, Belhaj was now out of jail and head of Tripoli's military council. Worse still, his old nemesis, Koussa, had shrewdly defected as Gaddafi crumbled and was able to confirm Belhaj's suspicions of British complicity in his fate.

Belhaj is not a man to hide a grievance and is now suing Allen and the British government for "complicity in torture" and "misfeasance in public office". He has reportedly been offered and refused £1m from the British government to shut up. As a tale of panic and cock-up it beats Smiley's People.

MI6 puts out the usual line that it only follows "ministerially authorised government policy". The relevant ministers at the time were Straw and Blair, who should have been fully briefed in 2004 on Gaddafi's apparent U-turn and the reasons behind it. Both men have denied knowledge of Belhaj's rendition and torture, or the suggestion that it and Megrahi's release were a quid pro quo for oil. Both have plaintively remarked that ministers may be responsible yet cannot know everything.

In Allen's defence, it can be said that he was doing exactly what his masters so badly wanted. Blair in 2004 was craven to Washington, desperate to win a spur in George Bush's crusade against militant Islamism. At the time, CIA rendition flights were criss-crossing the world with Muslims bolted to the floor. A couple more as a gift to a kindly dictator seemed small beer. As for whether Allen mentioned it to Straw, known to be supporting his bid to head MI6, neither he nor Straw is telling.

On Monday the foreign secretary, William Hague, grasped at the straw of Belhaj's law suit in declining to comment. He said, with a broad smile, that the whole matter was "sub judice". The implication, that his remarks might prejudice a trial, was that this would be held in public. But these are precisely the cases that the cabinet now wants to ensure are conducted in secret.

The morass now thickens. On 22 February, the court of appeal in London showed itself equally mesmerised by the "war on terror". It upheld the conviction of a London university student, Mohammed Gul, for disseminating "terrorism" over the internet. Not content with imprisoning the pathetic and repentant Gul for five years, their lordships felt an urge to political theory.

They declared that the war on terror embraced not just Gul but "acts by insurgents against the armed forces of a state anywhere in the world which sought to influence a government and were made for political purposes". Under legislation, terrorism included not just acts of violence but any threat made for "the purpose of advancing a political, religious, racial or ideological cause". These threats might include nothing more than a "serious risk to public health and safety" or "seriously to disrupt an electronic system".

From this catch-all lexicography, dissidents and insurgents under any regime were not excluded. Their lordships noted that it seemed there was nothing that would exempt those engaged in attacks on the military during the course of insurgency from the definition of terrorism. It was hard luck all Kurds, Kosovans, Benghazians, Tibetans and Iranian exiles – and today's Syrian rebels. They are all terrorists.

This is ridiculous. Gul's Bin Laden fantasies were not remotely in the same boat as Belhaj's opposition to Gaddafi. Yet both were seized as terrorists and imprisoned by agents of British government. They are joined in judicial calumny with millions round the world who are struggling against dictatorial regimes and willing harm to their "armed forces". Every student agitator is a terrorist, every internet hacker, cafeteria dissident, freedom fighter and insurgent leader. The war on terror is corrupting all it touches, while parliament meekly passes each twist of the ratchet of repression.

• This article was amended on 13 April 2012. It originally referred to Monday night's programme as a Panorama documentary. This has now been corrected