Mr Mohamed, 30, alleges he was tortured by US agents in Pakistan, Morocco and Afghanistan between 2002 and 2004 and that UK agencies were complicit in the practice.
In a ruling published on Wednesday, Lord Justice Thomas and Mr Justice Lloyd Jones said the attorney general would be investigating the issues of "torture and cruel, inhuman or degrading treatment" against Mr Mohamed.
The judges said they wanted the full details of the alleged torture to be published in the interests of safeguarding the rule of law, free speech and democratic accountability.
The details, believed to amount to just seven paragraphs, relate to the circumstances of Mr Mohamed's detention and his treatment while he was being held.
But they said they had been persuaded it was not in the public interest to do this due to the potential impact on UK national security of US stopping intelligence sharing.
By doing so, the US government could "inflict on the citizens of the UK a very considerable increase in the dangers they face at a time when a serious terrorist threat still pertains", they said.
Tory MP David Davis, who first raised the matter in the House of Commons, said the UK had been threatened with having security co-operation withdrawn if the information was published.
But Mr Miliband said there was no question of this happening.
"There has been no threat from the US to break off intelligence co-operation," he said.
Barack Obama has vowed to close the Guantanamo detention camp
He added: "Intelligence co-operation depends on confidentiality. We share our secrets with other countries and they share their secrets with us."
"It is US information and it is for the US to decide when to publish their information," Mr Miliband added.
The foreign secretary said the UK had never "condoned the use of torture".
Despite its stated desire to close Guantanamo within a year, the foreign secretary said there was "no evidence" that the Obama administration would take a different line on the publication of such information than the Bush administration.
However, the US government stressed that it investigated all allegations of torture including Mr Mohamed's case.
The Conservatives said the ruling raised "serious questions" and urged ministers to make a statement on the issue on Thursday.
"No British government should participate in or condone torture under any circumstances," said shadow foreign secretary William Hague.
"We hope that the new US administration will look again at this decision, particularly since the judge concerned that there were no security reasons for the material not to be made public."
Mr Davis said UK ministers should be asking whether it was "appropriate" for one democracy to threaten another with such a serious sanction as was being alleged.
"Frankly it is none of their business what our courts do," he said.
The BBC's Jonathan Beale in Washington said a former Bush administration official who dealt with Guantanamo Bay confirmed that US intelligence agencies did tell the UK that they opposed the release of certain US intelligence without their consent.
Civil liberties campaigners described the judges' remarks on the case as "astounding".
What we have in Guantanamo is a legal black hole
Moazzam Begg, former detainee
Shami Chakrabarti, director of Liberty, said the Bush administration had tried "to bully" the British courts and President Obama must make it clear he would not do the same.
The Lib Dems said the UK government had "just rolled over" in the face of US demands.
"There is no other terms for what the US intelligence services are doing than blackmail," said Lib Dem leader Nick Clegg.
"It is simply incredible that the US government would have halted intelligence co-operation with the UK if this information had been made public."
Moazzam Begg, a British former detainee of Guantanamo Bay, told the BBC he wanted to see an end to all forms of imprisonment without trial.
"How does any society determine whether anybody's detention is justified?" he said. "They do it through a court process, a legal process, that's recognised and transparent... but what we have in Guantanamo is a legal black hole."
Another British ex-detainee Omar Deghayes told the BBC he knew Mr Mohamed in Guantanamo and that he had spoken of being tortured.
He also said he was sure that British intelligence agents had questioned him and others there on numerous occasions.
"Everyone who was detained there from here will tell you that MI5 and MI6 came and interrogated them," he said.
Mr Deghayes said it was "shameful" that British judges were being "blackmailed" and it should be up to "the rule of law to decide whether somebody is guilty or not".
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.