British intelligence agencies have policies allowing staff to access confidential communications between lawyers and their clients, official documents have revealed.
The guidance was disclosed for the first time at a tribunal which examines complaints against MI5, MI6 and GCHQ.
The lawyer-client relationship is generally protected by strict rules.
Campaigners said the disclosure had "troubling implications for the whole British justice system".
The government could be handed an unfair advantage in court if it had access to confidential materials, they said.
In one case, MI5 revealed, legally privileged information had been inappropriately passed to lawyers defending the security agencies, where "the potential for tainting" was identified.
The Investigatory Powers Tribunal (IPT) heard that updated MI5 guidance published in January advised lawyers that while there was no "legal prohibition" on reading privileged material relating to their cases, doing so should be "avoided" to prevent prejudicing proceedings.
The guidance documents were released following a legal action brought on behalf of two Libyan men - Abdul Hakim Belhaj and Sami al-Saadi - who have sued the British government for alleged complicity in their detention and rendition.
Disclosure of all the materials was resisted on national security grounds by the government until an IPT hearing last week when it reversed its position.
A government spokesman said: "We do not comment on ongoing legal proceedings."
Lawyer-to-client materials are generally covered by legal professional privilege (LPP) to safeguard privacy and the right to a free trial.
Policy papers held by all three agencies on dealing with LPP material were disclosed through the IPT.
Guidance issued by GCHQ said its staff "may in principle target the communications of lawyers", although it adds "you must give careful consideration to necessity and proportionality".
An MI5 document said legally privileged material may be used "just like any other item of intelligence".
The guidance went on to flag the "particular sensitivity" attached to privileged material and the need to "test thoroughly" the justification for its use.
The three agencies did not until recently have policies that blocked their lawyers and officials from seeing intercepted privileged material about cases they were involved in, the documents also show.
What do the agencies do?
- The Security Service - MI5 - is the UK's security intelligence agency, responsible for protecting the UK, its citizens and interests
- The Secret Intelligence Service - SIS or MI6 - operates worldwide and is responsible for gathering secret intelligence outside the UK
- GCHQ is the UK's electronic intelligence gathering agency
Families involved with the Belhaj case brought a claim to the IPT over concerns that their private discussions with legal charity Reprieve and law firm Leigh Day were being intercepted, in the wake of Edward Snowden's disclosures on mass surveillance.
The families have brought litigation about the rendition and allege that any interception of privileged communications has infringed their right to a fair trial.
Richard Stein, partner at Leigh Day, said: "After many months' resistance, the security services have now been forced to disclose the policies which they claim are in place to protect the confidential communications between lawyers and their clients.
"We can see why they were so reluctant to disclose them. They highlight how the security services instruct their staff to flout these important principles in a cavalier way.
"We hope the tribunal will tell the government in no uncertain terms that this conduct is completely unacceptable."
Cori Crider, a lawyer for the two Libyans and a director at human rights charity Reprieve, said: "It's now clear the intelligence agencies have been eavesdropping on lawyer-client conversations for years.
"This raises troubling implications for the whole British justice system. In how many cases has the government eavesdropped to give itself an unfair advantage in court?"
'Hall of mirrors'
Rachel Logan, Amnesty UK's legal advisor, said it "clearly violates an age-old principle of English law set down in the 16th Century - that the correspondence between a person and their lawyer is confidential".
"It could mean, amazingly, that the government uses information they have got from snooping on you, against you, in a case you have brought," she said.
"That affords the government an unfair advantage akin to playing poker in a hall of mirrors."
She said it called into question a range of concluded cases in which the government had been involved, "from criminal convictions to asylum proceedings".
Liberty's director of policy, Isabella Sankey, said the "explosive disclosure" made a "sham" of the privileged relationship between lawyer and client and undermined the fairness of cases involving the state.
Conservative MP David Davis described it as a "national scandal".
Raising the matter in the House of Commons, he said: "It has long been taken as the standard in this country that the relationship between a lawyer and a client is protected by privilege and communications between them are protected from intervention by the state.
"What has become clear this morning is that not only is that not the case at the moment but that each of the three agencies have got policies for handling legally-protected material and in one case for deliberately withholding that material even from secret courts and security-cleared special advocates."