The court said individual countries "enjoy a wide margin of appreciation in choosing how best to achieve the legitimate aim of protecting national security" and that "the decision to operate a bulk interception regime in order to identify hitherto unknown threats to national security is one which continues to fall within states’ margin of appreciation".
In a new ruling, though, the court found that UK laws that used to regulate how the bulk interception of communications was operated violated the European Convention on Human Rights because they provided for a lack of sufficient oversight and safeguards in relation to that activity. Privacy campaigners Big Brother Watch and other human rights organisations had challenged the rules.
The ECtHR said: "While there is no evidence to suggest that the intelligence services are abusing their powers – on the contrary, the interception of communications commissioner observed that the selection procedure was carefully and conscientiously undertaken by analysts –, the Court is not persuaded that the safeguards governing the selection of bearers for interception and the selection of intercepted material for examination are sufficiently robust to provide adequate guarantees against abuse. Of greatest concern, however, is the absence of robust independent oversight of the selectors and search criteria used to filter intercepted communications."
The court also flagged problems with "the absence of any real safeguards applicable to the selection of related communications data for examination".
The shortcomings meant that the rules on bulk interception of communications were in breach of privacy rights under Article 8 of the Convention, it ruled.
The judgment concerns aspects of the Regulation of Investigatory Powers Act (RIPA), a law dating back to 2000 which has been superseded by new UK surveillance laws in recent years. The adherence of the new legislation to the Convention was not considered by the ECtHR.
The Investigatory Powers Act was introduced in 2016 to update UK surveillance laws, but it too has been subject to legal action. Earlier this year, the High Court gave the UK government until 1 November this year to revise the UK's communications data laws under part four of the Act after it found the current provisions were "incompatible with fundamental rights in EU law in the area of criminal justice".
The ECtHR found that similar faults to those found by the High Court in relation to part four of the Investigatory Powers Act were also present in RIPA.
The RIPA rules permitted UK authorities to gain access to communications data stored by telecommunications providers for the purpose of combating crimes that fell below the 'serious crime' threshold and generally without access being subject to prior review by a court or independent administrative body, the ECtHR said. This was a violation of the Article 8 privacy rights under the Convention, it said.
The court further ruled that the faults with the rules on bulk interception of communications and with the acquisition of communications data also represented a breach of Article 10 of the Convention, which concern the freedom of expression, because of how the provisions could undermine the confidentiality of journalistic material or journalists' sources.
However, the ECtHR rejected complaints regarding the way in which UK law facilitated the sharing of "intercept material" with foreign intelligence agencies, and further said that campaigners must seek to resolve disputes relating to surveillance matters before the UK's Investigatory Powers Tribunal in future before raising a case with the ECtHR unless they can show "special circumstances" applied.