Evidence of how a British resident held in the Guantánamo Bay detention camp was tortured, and what MI5 knew about it, must remain secret because of serious threats the US has made against the UK, the high court ruled today.

The judges made clear they were deeply unhappy with their decision, but said they had no alternative as a result of a statement by David Miliband, the foreign secretary, that if the evidence was disclosed the US would stop sharing intelligence with Britain. That would directly threaten the UK's national security, Miliband had told the court.

This afternoon David Davis, the Conservative MP and former shadow home secretary, said ministers must urgently respond to the allegations that Britain was complicit in torture. He demanded a Commons statement from the government on the ruling, calling it "a matter of utmost national importance".

Davis said: "The ruling implies that torture has taken place in the [Binyam] Mohamed case, that British agencies may have been complicit, and further, that the United States government has threatened our high court that if it releases this information the US government will withdraw its intelligence cooperation with the United Kingdom.

"The judge rules that there is a strong public interest that this information is put in the public domain even though it is politically embarrassing."

He told the BBC: "The government is going to have to do some pretty careful explaining about what's going on."

The ruling, by Lord Justice Thomas and Mr Justice Lloyd Jones, was the latest from a long-running and unprecedented series of court hearings into the abduction of Binyam Mohamed, who was seized and held incommunicado in Pakistan in 2002 before being secretly rendered to Morocco, where he says he was tortured.

He was subsequently flown to Afghanistan before being rendered to Guantánamo Bay.

Today's ruling comes after the judges last year invited the Guardian and other media groups to question earlier claims by Miliband that the disclosure of evidence, originally contained in documents given to him by the US government, would threaten the UK's national security.

The judges said today that they found it "difficult to conceive" the rationale for the US's objections to releasing the information, which contained "no disclosure of sensitive intelligence matters" about how US officials treated detainees.

"Indeed, we did not consider that a democracy governed by the rule of law would expect a court in another democracy to suppress a summary of the evidence contained in reports by its own officials ... relevant to allegations of torture and cruel, inhumane or degrading treatment, politically embarrassing though it might be," they said.

The judges said they had been taken aback by the severity of the threat made by the US government.

In another part of the ruling, the judges said lawyers for Miliband had told them the threat to withdraw cooperation remained in place under the new administration of President Barack Obama.

Clive Stafford Smith, Mohamed's lawyer and director of Reprieve, said the UK and US governments had a duty to investigate torture claims, and not to suppress evidence that it had happened.

By not disclosing the evidence, the UK was guilty of "capitulation to blackmail", he said.

Shami Chakrabarti, director of human rights group Liberty, called for ministers to launch an inquiry into Britain's alleged role in rendition and torture.

She said it was "alarming and surprising" that the new US administration maintained the threat against the Foreign Office.

Mohamed was originally charged with involvement in a "dirty bomb" plot, but that charge was withdrawn and the US authorities said new ones could be brought.

But no fresh indictment was filed, and on January 22 President Obama issued an executive order that no new charges should be sworn, pending a review of the position of all those detained at Guantánamo Bay.