U.K. intelligence agencies were forced to release a cache of documents on Thursday exposing their illegal surveillance tactics that included spying on privileged communications between human rights lawyers and their clients in security cases.

Internal memos from MI5, MI6, and GCHQ, released in response to a case brought by the Investigatory Powers Tribunal, show that the unlawful tactics were sanctioned by the agencies and may have infringed on justice in at least two high-profile torture cases that implicated the U.K. government—those of Libyan political activists Sami al Saadi and Abdel-Hakim Belhaj.

If the government is able to access legally privileged (LPP) documents in a case against its own agencies, it gives itself an unfair advantage in court, said legal charity Reprieve, which sought the release of the documents.

MI5's policies, for example, state that "[i]n principle, and subject to the normal requirements of necessity and proportionality, LPP material may be used just like any other item of intelligence."

GCHQ said its staff "may in principle target the communications of lawyers."

In at least one instance, LPP material was inappropriately passed to lawyers who were involved in a lawsuit against the agencies—where the government admitted on Thursday "the potential for 'tainting' was identified."

"It’s now clear the intelligence agencies have been eavesdropping on lawyer-client conversations for years," Reprieve director Cori Crider, who also represents the Belhaj and al Saadi families, said on Thursday. "Today's question is not whether, but how much, they have rigged the game in their favour in the ongoing court case over torture."

Amnesty International echoed the sentiment, saying the government was gaining “an unfair advantage akin to playing poker in a hall of mirrors."

"This clearly violates an age-old principle of English law set down in the sixteenth century; that the correspondence between a person and their lawyer is confidential," said Rachel Logan, Amnesty U.K. legal adviser. "It could mean, amazingly, that the government uses information they have got from snooping on you, against you, in a case you have brought."

Belhaj and al Saadi are suing several UK intelligence agencies and officials for collusion with the CIA in their and their families' abduction and rendition to Libya, where they were reportedly tortured by security forces of Muammar Gaddafi.

After NSA whistleblower Edward Snowden exposed the scope of U.S. and U.K. intelligence agencies' invasive surveillance tactics, Belhaj's lawyers said at an Investigatory Powers Tribunal hearing in January that they had reason to suspect the GCHQ had been listening to their phone calls with their client. They told the tribunal at the time, "The right to confidential client-lawyer communication is a fundamental principle of justice."

Belhaj's initial case was thrown out in December of last year when a high court ruled that pursuing legal action could harm Britain's "national interests." The government used identical rhetoric to argue against disclosing MI5 and MI6 policies on seizure and use of legally privileged material, but suddenly changed its tune in late October, Reprieve said.

Dinah Rose QC, one of Belhaj's lawyers, told the tribunal on Thursday that the revelations have implications far beyond the cases at hand—that the policies may have resulted in untold miscarriages of justice.

"Even the most recent policies do not adequately provide for proper information barriers [between] those handling litigation and those who received the intercepted legally privileged material," Rose told the tribunal. "This [Belhaj] case is the tip of the iceberg. It raises questions about a large number of cases and about the integrity of judgments reached by courts in civil and criminal cases. We have a situation where the policies, on the face of it, appear to permit lawyers to be involved in practices that are unlawful and unethical."

The memos released on Thursday seem to contradict at least some of the language included in one agency's own documents, which states, "Material subject to LPP is amongst the most sensitive sorts of information that may be obtained by the security service. The confidentiality of lawyer-client communications is fiercely guarded by the law and any departure from it in the national security context must be narrowly construed and strictly justified."

As Reprieve notes, "MI6 has virtually no guidance for its officers on the interception and use of private lawyer-client material. Such policies as they do have are dated September 2011, the month the Libyan renditions documents became public."

"Today’s revelations call into question a whole range of concluded cases in which the government has been involved from criminal convictions to asylum proceedings," Amnesty's Logan said on Thursday. “It also calls into question the professional and ethical conduct of individual lawyers working for the government. It’s no wonder the government resisted making this disgraceful policy public. The government’s disingenuous reliance on ‘national security’ as a reason for not making this policy public previously, is not only deceitful but hugely sinister.”