Mr Miliband argued that releasing the material would threaten Britain's national security because future intelligence sharing with the US could be compromised.
But Lord Justice Thomas and Mr Justice Lloyd Jones ruled that the risk to national security was "not a serious one" and there was "overwhelming" public interest in disclosing the material.
Their judgement was also delayed on Friday because MI5 insisted part of it - explaining why there was such a significant public interest in the case - should be redacted.
Responding to the ruling, Mr Miliband told the BBC the court had "fundamentally misunderstood" the key principle of intelligence sharing.
"We have no objection to this material being published by the appropriate authorities, in this case the United States," he said.
By Dominic Casciani, home affairs correspondent, BBC News
This judgement is part of the high-stakes political poker game surrounding what we can and cannot know about the intelligence agencies that act in our name.
They share information confidentially to save lives and co-ordinate a strategy against enemies like al-Qaeda, but the government says they don't do so thinking it will be made public.
The High Court insists the seven key paragraphs it wants to publish are in no way damaging to national security. And it's worth noting that the judges have not ordered the release of 42 other documents in the case.
This ruling looks unprecedented because it strongly defends the public's right to know and says ministers cannot hide away sensitive allegations of wrongdoing. But the reality is more nuanced because the court has not overruled the interests of national security. The ball is back in the government's court.
"What I do have a very deep objection to is the idea that a British court should publish American secrets - in the same way that I would have a deep objection if an American court started publishing British secrets."
Mr Miliband said the government stood "firmly against torture and cruel, inhuman and degrading treatment or punishment", but he vowed to continue to challenge the court's ruling "in the strongest possible terms".
The US also denies any allegations of torture concerning Mr Mohamed and a former senior official in the Bush administration told the BBC releasing the material would have an "enormous chilling effect" on US-UK relations.
Mr Mohamed, who once lived in north Kensington, London, was first detained in Pakistan in 2002. He was questioned there by an MI5 officer before being transferred to Morocco.
He says while in US custody in Morocco he was tortured at the behest of the CIA and asked questions supplied by British intelligence agency MI5.
Mr Mohamed was later transferred to Guantanamo Bay and eventually released in February this year.
Before Friday's judgment, Mr Mohamed told BBC the material should be released.
It is irrational to pretend that evidence of torture should be classified as a threat to national security
Clive Stafford-Smith Binyam Mohamed's lawyer
He said: "The public needs to know what their government has been up to for the last seven years.
"There's information in there, which I'm 99% sure, states that the US sub-contracted the UK government to do its dirty work."
Clive Stafford-Smith, Mr Mohamed's lawyer and director of human rights charity Reprieve, said the government was "trying to conflate national security with national embarrassment".
"The judges have made clear what we have said all along - it is irrational to pretend that evidence of torture should be classified as a threat to national security," he said.
"Rather, it is proof of a crime committed against Binyam Mohamed, and as such it should be fully aired in a court of law."
Shadow foreign secretary William Hague said it was "for the US administration to decide whether or not these paragraphs should be released".
"However, there are still serious questions about the British government's handling of Binyam Mohamed's case, and the foreign secretary's inability to convince the court that in this particular case the government's policy is right," he said.
Liberal Democrat foreign affairs spokesman Ed Davey said the court was right to argue that publication would not jeopardise British-American security co-operation.
"The foreign secretary is in danger of putting his own judgement about the security services above the rule of law and democracy," he added.
Ex-shadow home secretary David Davis - who first raised the case in the House of Commons - said it was "time for the government to accept the ruling of the court and stop trying to delay proceedings with further futile appeals".
Mr Davis added: "The British public have a right to know the judges' assessment of the extent of complicity of the UK and US intelligence services in torture, and to determine for themselves why the government has tried for so long to cover up this assessment."
Liberty Shami Chakrabarti said the government "should be shamed" by the ruling, adding: "Our courts should be gagged no longer and the crucial incriminating paragraphs published without delay."
In March, Attorney General Baroness Scotland confirmed the police would investigate whether an MI5 officer had been complicit in the alleged torture of Mr Mohamed.
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.