Mass surveillance of the internet by UK intelligence services has been unlawful in the past but now complies with legislation, a watchdog has ruled.
In its second judgment relating to a case brought by civil liberty groups, the Investigatory Powers Tribunal (IPT) found that an intelligence-sharing relationship between Britain's listening post GCHQ and America's National Security Agency (NSA) breached human rights laws prior to December last year.
Human rights groups Privacy International and Amnesty, along with Liberty, brought a legal challenge against GCHQ following disclosures made by NSA whistleblower Edward Snowden about mass surveillance programmes. Rules governing the UK's access to the NSA's mass surveillance programmes, known as Prism and Upstream, were secret and it was not until they were revealed by the Government in December that GCHQ's activity became compliant with the European Court of Human Rights, the IPT said.
A video-still shows Edward Snowden - whose revelations led to the lawsuit
"The world owes Edward Snowden a great debt for blowing the whistle, and today's decision is a vindication of his actions. But more work needs to be done," said Eric King of Privacy International.
The groups argued that GCHQ's methods breached Article 8 of the European Convention on Human Rights (ECHR), the right to privacy, as well as Article 10, which protects freedom of expression.
However, in its first written judgment in December, the IPT ruled that the legal regime overseeing GCHQ's mass surveillance programmes was from that point lawful.
A panel of IPT judges said: ''We have been able to satisfy ourselves that, as of today, there is no contravention of Articles 8 and 10 by reference to those systems. ''We have left open for further argument the question as to whether prior hereto there has been a breach.''
But the tribunal said questions remain over whether the systems which oversee the listening post's methods of interception were legal in the past. These questions have now been addressed in today's second judgment.
Essentially, the IPT has found that, by revealing the safeguards in place during the legal proceedings, the intelligence-sharing programme became compliant. However, prior to this, these legal frameworks were not publicly disclosed and therefore the regime violated Article 8 of the European Convention on Human Rights, the right to privacy, and Article 10, which protects freedom of expression.
It is the first time the tribunal, which considers complaints brought against GCHQ, MI5 and MI6, has found against the intelligence agencies in its 15-year history.
Liberty, one of the groups which brought the legal challenge against the intelligence agencies, said it disagrees that the safeguards revealed in December are sufficient to make GCHQ's intelligence-sharing activities lawful and will challenge the decision at the European Court of Human Rights.
But GCHQ said the Tribunal had ruled that the legal frameworks governing both the bulk interception regime and the intelligence-sharing regime itself were compatible with human rights.
A GCHQ spokesman said: "We are pleased that the Court has once again ruled that the UK's bulk interception regime is fully lawful. It follows the Court's clear rejection of accusations of 'mass surveillance' in their December judgment. The IPT has, however, found against the Government in one small respect in relation to the historic intelligence-sharing legal regime.
"The Court has ruled that the public disclosure of two paragraphs of additional detail, voluntarily disclosed by the Government during the litigation, were essential to make the public regime sufficiently foreseeable and therefore fully compatible with the European Convention of Human Rights.
"They found that to the extent that these two paragraphs were not previously in the public domain, the intelligence-sharing regime prior to that point was in contravention of human rights law.
"But the judgment does not in any way suggest that important safeguards protecting privacy were not in place at all relevant times. It does not require GCHQ to change what it does to protect national security in any way."
The GCHQ spokesman added: "Today's IPT ruling re-affirms that the processes and safeguards within the intelligence-sharing regime were fully adequate at all times - it is simply about the amount of detail about those processes and safeguards that needed to be in the public domain. We welcome the important role the IPT has played in ensuring that the public regime is sufficiently detailed. By its nature, much of GCHQ's work must remain secret.
"But we are working with the rest of Government to improve public understanding about what we do and the strong legal and policy framework that underpins all our work. We continue to do what we can to place information safely into the public domain that can help to achieve this."
James Welch, legal director for Liberty, said: "We now know that, by keeping the public in the dark about their secret dealings with the National Security Agency, GCHQ acted unlawfully and violated our rights.
"That their activities are now deemed lawful is thanks only to the degree of disclosure Liberty and the other claimants were able to force from our secrecy-obsessed Government.
"But the Intelligence Services retain a largely unfettered power to rifle through millions of people's private communications - and the Tribunal believes the limited safeguards revealed during last year's legal proceedings are an adequate protection of our privacy. We disagree, and will be taking our fight to the European Court of Human Rights."
Elizabeth Knight, legal director at Open Rights Group, said: "This ruling is a very welcome first step. It shows that secret policies are not an acceptable basis for highly intrusive intelligence-sharing practices. However, the IPT has not gone far enough.
"These flimsy policies are not enough to comply with the requirements of human rights law, even now they are public. And GCHQ's own Tempora programme of mass interception is clearly both unlawful and disproportionate. We hope the European Court of Human Rights will go further than the IPT and find that mass surveillance breaches our human right to privacy."
A Downing Street spokeswoman said the judgment did not require GCHQ to change its operations. The spokeswoman said: "The overall judgment this morning is that the UK's interception regime is fully lawful. That follows on from the court's clear rejection of accusations of mass surveillance in their December judgment, and we welcome that.
"It's important to be clear that the overall interception regime and bulk interception they found fully, fully lawful, and that it was compliant with the right to privacy at all times. What they said was, on the legal framework governing that, that there should be more about the rules that should be disclosed publicly. I think it was two paragraphs of additional detail, and the Government did that during the proceedings.
"They are not questioning in this judgment that the safeguarding of privacy was in any way jeopardised and the judgment will not require GCHQ to change what it does."
The spokeswoman said that Prime Minister David Cameron believes the Government should make sure that the intelligence agencies "continue to have the powers they need to keep us safe".