U.K. spies acted illegally when they scooped up data about Britons’ electronic communications gathered by the U.S. National Security Agency, a court ruled Friday in a landmark judgment against Britain’s security services.

But the judges said now that details of the practices are known, they are within the law.

Britain’s Investigatory Powers Tribunal, which deals with complaints against the intelligence services, ruled in a case brought by civil liberties groups against the electronic intelligence agency, GCHQ.

It said that before December 2014, “the regime governing the soliciting, receiving, storing and transmitting by U.K. authorities of private communications of individuals” gathered by the NSA contravened European Union protections of privacy and freedom of expression.

But it said the practices were now legal — because the rights groups’ lawsuit had made details of the procedures and safeguards public.

The groups brought the case after U.S. intelligence analyst Edward Snowden’s disclosures about the mass harvesting of communications data. Snowden disclosed NSA programs known as PRISM — which accessed data from Internet firms such as Yahoo and Google — and Upstream, which tapped into undersea communications cables.

The groups that brought the claim — Liberty, Privacy International, Bytes for All and Amnesty International — called the judgment a partial victory. It is the first time the tribunal has ruled against an intelligence agency since it was established 15 years ago.

Privacy International director Eric King said the ruling confirmed that “over the past decade, GCHQ and the NSA have been engaged in an illegal mass surveillance-sharing program that has affected millions of people around the world.”

The groups said they would appeal the ruling that the data-sharing was now legal to the European Court of Human Rights.

The ruling does not require GCHQ to pay a fine or delete any of the illegally gathered data, though individuals can ask the tribunal to find out whether their communications were intercepted unlawfully. If so, GCHQ could be forced to delete it.

GCHQ said it was pleased the court had found that it complied with the law. It also said the ruling “does not require GCHQ to change what it does to protect national security in any way.”