The attorney general has handed his file on the British agents involved in torture to the police, however.

The high court's original judgement on Binyam Mohamed's case last year was forced to keep a seven-paragraph summary secret after claims it would damage national security.

The summary relates to when Mr Mohamed was held by US authorities in Pakistan.

But it also implicitly reveals what the British knew about the conditions Mr Mohamed was held in.

It describes how he was deprived of sleep and then threatened and induced to cooperate. The stress was increased by the fact he was shackled.

Mr Mohamed had to be kept under observation of self-harm as a result of the stress created by his treatment.

The judges found that if the actions had been committed by British officials the country would have found itself in breach of the 1972 torture convention, and that the treatment amounted to cruel, inhumane and degrading treatment.

Judges decided it was no longer tenable to keep the paragraphs secret given their publication in a US court.

The ruling read: "We regret to have to include that the reports provided to the Security Service made clear to anyone reading them that BM was being subjected to the treatment that we have described and the effect upon him of that intentional treatment.

"The treatment reported, if it had been administered on behalf of the United Kingdom would clearly have been in breach of [a ban on torture].

"Although it is not necessary for us to categorise the treatment reported, it could be readily contented to be at the very least cruel, inhuman and degrading treatment of BM by the United States authorities."

The material helped to "vindicate Mr Mohamed's assertion that UK authorities had been involved in and facilitated the ill- treatment and torture to which he was subjected while under the control of USA authorities".

The former Guantanamo detainee says he was tortured in Pakistan with the complicity of CIA and British intelligence.

The original judges, Lord Justice Thomas and Mr Justice Lloyd Jones wanted full disclosure of the information relating to Mr Mohamed's treatment.

But Mr Miliband said disclosure of the information would threaten information sharing between the UK and the US and that the court had misunderstood the principle of information sharing.

The foreign secretary suggested the reasoning of the judgement vindicated his position today.

"This is not just about legal obligations, it's about our values as a nation. It's about what we do as well as what we say," he told the Commons.

"This judgement is not evidence the system is broken rather it is evidence the system is working.

"No one likes to lose a case but the force of this judgement is that it confirms that principle."

A Foreign Office statement added: "The court has today ordered the publication of the seven paragraphs because in its view their substance had been put into the public domain by a decision of a US court in another case. Without that disclosure, it is clear that the court of appeal would have overturned the divisional court's decision to publish the material."

Shadow foreign secretary William Hague said: "The government should have done what we called for a year ago, which was to ask the United States to permit the publication of this information about Binyam Mohamed as an exceptional case.

"If they had done this and if the US had agreed, we would have arrived at the same outcome as today's court judgement more quickly, without further expensive legal proceedings, and in a way that left the government less open to the charge that it was withholding from the public evidence of complicity in torture."

Shami Chakrabarti, director of Liberty, demanded a public enquiry.

"It has been clear for over a year that the Foreign Office has been more concerned with saving face than exposing torture," she said today.

"These embarrassing paragraphs reveal nothing of use to terrorists but they do show something of the UK government's complicity with the most shameful part of the war on terror."

Clive Stafford Smith, director of Reprieve, said today's events were just the tip of the iceberg.

"Our government went to enormous lengths to prevent the British public from seeing this tiny fraction of Binyam's story. They still refuse to admit that he was abused," he said.

"Today's decision is very welcome, but the paragraphs revealed are only the tip of the iceberg when it comes to British complicity in torture - much more is to come."

Liberal Democrat foreign affairs spokesman Edward Davey said: "This is an embarassing defeat for David Miliband and a victory for open government. Once again we have had to wait for the courts to force the government to do the right thing. Whatever happened to Gordon Brown's moral compass?

"The significance of the foreign secretary's defeat lies in the contents of the seven paragraphs that he has now been forced to publish. These make it clear that the British secret services knew the United States was torturing Binyam Mohamed.

"This raises questions about what actions the government then took to object to that torture and to meet Britain's international legal obligations."

Mr Mohamed was backed by his lawyers, anti-torture groups and the international press.

An Ethiopian granted refugee status in Britain, he was first detained in Pakistan in 2002 before being rendered to Morocco and Afghanistan and finally Guantanamo Bay two years later.

Today's appeal was heard by the lord chief justice, Lord Judge; the master of the rolls, Lord Neuberger; and the president of the Queen's Bench Division, Sir Anthony May.