A top Foreign Office official has accused high court judges of damaging Britain's national security by insisting that CIA evidence of British involvement in torture must be revealed.

The extraordinary intervention in a fierce dispute between David Miliband, the foreign secretary, and the high court has come from Simon Manley, the FCO's director of defence and strategic threats.

In an unprecedented assault on the judiciary, he claims that demands by two judges that the CIA material should be disclosed have already harmed Britain's intelligence and diplomatic relations with the US. In a statement, Manley says the judges have "served to undermine confidence within the US in the UK's ability to protect the confidentiality of diplomatic exchanges and will inevitably have a negative impact on the candour of their exchanges with UK officials".

The impact of the judges' rulings "also undermines our relationships with other foreign services … and co-operation on operational matters in the field is also at stake", he adds. "What we are facing is an erosion of trust."

The statement is a response to the fifth judgment by Lord Justice Thomas and Mr Justice Lloyd Jones in the long-running case of Binyam Mohamed, the British resident incarcerated by the CIA in secret prisons before being rendered to Guantánamo Bay.

Media groups, led by the Guardian, have joined the action, arguing that what the CIA told MI5 and MI6 about Mohamed's ill-treatment, and the British government's response, should be revealed.

What made the FCO ratchet up the dispute is the judges' devastating ruling last month, when they accused Miliband of acting in a way that was harmful to the rule of law by suppressing evidence about what the government knew of the illegal treatment of Mohamed.

The judges rejected the foreign secretary's claims that disclosing evidence of unlawful treatment would harm national security and threaten the UK's vital intelligence-sharing arrangements with the US. "The suppression of reports of wrongdoing by officials in circumstances which cannot in any way affect national security is inimical to the rule of law," they ruled. "In our view, as a court in the United Kingdom, a vital public interest requires … that a summary of the most important evidence relating to the involvement of the British security services in wrongdoing be placed in the public domain … Championing the rule of law, not subordinating it, is the cornerstone of democracy."

Ethiopian-born Mohamed, now living in the UK, says he was tortured with the knowledge of British security and intelligence agencies. The CIA information includes an account given to British intelligence "whilst [Mohamed] was held in Pakistan … prior to his interview by an officer of the Security Service", the judges revealed. The officer, known only as Witness B, is being investigated for possible criminal wrongdoing.

The judges made it clear they were exasperated by the attitude of the foreign secretary and British officials. There was no "rational basis" for claims made by Miliband and Hillary Clinton, the US secretary of state, that disclosure of the CIA material would put British lives at risk.

At the heart of the dispute is a seven-paragraph CIA document that the British government insists must remain secret. The judges, who have seen the CIA document, have repeatedly said it does not contain any sensitive intelligence material. "There is nothing in the redacted paragraphs that are in any way secret and the foreign secretary will have to justify [his claims]," Thomas said after handing down last month's judgment.

The issue will go to appeal. However, the court is also embroiled in four other currently redacted passages in the fifth judgment. One passage Miliband wants to keep secret comes immediately after the judges' reference to memos released by the Obama administration, setting out "details of the treatment inflicted on detainees by the CIA". Another passage refers to what the judges call the need to "stand back and ask the question whether President Obama would curtail the supply of information to the United States' oldest ally when what was put into the public domain was not intelligence".

They continue: "It is difficult … to see any grounds for rejecting the submission of [Mohamed], the UK media and the international media, that there is any evidence of any real risk of serious harm to the national security of the UK."