The Strasbourg-based court found in a 5-2 ruling that the practice, first revealed in documents leaked by former U.S. National Security Agency contractor Edward Snowden in 2013, failed to safeguard rights to privacy guaranteed under the human rights convention.

“While the Court was satisfied that the intelligence services of the United Kingdom take their Convention obligations seriously and are not abusing their powers, it found that there was inadequate independent oversight of the selection and search processes involved in the operation, in particular when it came to selecting the Internet bearers for interception and choosing the selectors and search criteria used to filter and select intercepted communications for examination,” according to a statement from the court. “Furthermore, there were no real safeguards applicable to the selection of related communications data for examination, even though this data could reveal a great deal about a person’s habits and contacts.”

The court ruled that bulk interception of data could in theory be legal, provided there are restrictions on what types of criminal offenses can lead to the wiretapping, how long data can be stored, how it can be used, and when it must be destroyed. But those requirements weren’t met by the U.K. program, the court found. The court also ruled that U.K. policies about sharing data with foreign intelligence agencies don’t violate the human rights convention.

Snowden had revealed that the Government Communications Headquarters, a U.K. signals intelligence agency comparable to the NSA, was collecting wide swaths of internet data through a program called Tempora. GCHQ hasn’t confirmed or denied the existence of the program, the Guardian reports. Snowden and other privacy activists, including the American Civil Liberties Union, praised the decision Thursday.

For five long years, governments have denied that global mass surveillance violates your rights. And for five long years, we have chased them through the doors of every court. Today, we won. Don’t thank me: thank all of those who never stopped fighting. https://t.co/ARgbI5PKaa — Edward Snowden (@Snowden) September 13, 2018

“The decision sends a clear message that similar surveillance programs, such as those conducted by the NSA, are also incompatible with human rights,” ACLU attorney Patrick Toomey said in a Thursday statement. “Governments in Europe and the United States alike must take steps to rein in mass spying and adopt long overdue reforms that truly safeguard our privacy.”

The ACLU, along with other civil liberties groups around the world, initially brought the complaint in the case.