But it also found that the method employed for sharing digital information with other governments was not illegal, and that if better safeguards existed, then bulk interception was allowed.
The case was brought in the wake of the revelations by NSA whistleblower Edward Snowden by a group known as Big Brother Watch and a number of other organisations. It was over surveillance programs and intelligence sharing between the US and the UK.
In 2014, the Investigatory Powers Tribunal - the UK court which hears claims against GCHQ, MI5 and MI6 - ruled that the methods used to collect information could, in principle, comply with the UK’s human rights obligations.
The case was over complaints by journalists and civil liberties organisations about three kinds of surveillance:
- bulk interception of communications;
- intelligence sharing with foreign governments; and
- the obtaining of communications data from service providers.
The case was over the old British law and there are already a number of challenges to the new law, known as the Snoopers Charter.
In a statement, Lucy Claridge, the strategic litigation director of Amnesty International, one of the parties to the case, said: "“Today’s ruling represents a significant step forward in the protection of privacy and freedom of expression worldwide.
"It sends a strong message to the UK Government that its use of extensive surveillance powers is abusive and runs against the very principles that it claims to be defending.
“This is particularly important because of the threat that government surveillance poses to those who work in human rights and investigative journalism, people who often risk their own lives to speak out.
"Three years ago, this same case forced the UK Government to admit GCHQ had been spying on Amnesty - a clear sign that our work and the people we work alongside had been put at risk.”
Megan Goulding, a lawyer for Liberty, another party to the case, said: "“This is a major victory for the rights and freedom of people in the UK. It shows that there is — and should be — a limit to the extent that states can spy on their citizens.
"Police and intelligence agencies need covert surveillance powers to tackle the threats we face today – but the Court has ruled that those threats do not justify spying on every citizen without adequate protections.
“Our government has built a surveillance regime more extreme than that of any other democratic nation, abandoning the very rights and freedoms terrorists want to attack. It can and must give us an effective, targeted system that protects our safety, data security and fundamental rights.”