A British court ruled Friday that the United Kingdom's access to spying data collected by the National Security Agency was illegal until just two months ago, marking one of the sharpest legal rebukes of government surveillance in the post-Snowden era.

The sharing arrangement was unlawful, the Investigatory Powers Tribunal found, because it lacked sufficient transparency safeguards and therefore amounted to a violation of human-rights law.

The stunning court opinion represents the first time the U.K. tribunal has sided with a complaint raised against Britain's intelligence services in the tribunal's 15-year history. It follows a rejection in December of a claim that Britain's notoriously aggressive surveillance powers violated human rights under European law. But that previous opinion prompted the U.K. government to disclose secret rules governing its storage and access to the personal data of British citizens collected by the NSA.

Before those disclosures, the information-sharing agreement between the two allies was unlawful, the court said. But it is now appropriate, given the added transparency, it added.

The immediate ramifications for the U.S. intelligence community appear to be only superficial, as the tribunal said the spying arrangement was unlawful only up to December 2014.

But the ruling could lay the groundwork for future legal challenges from Europe, where several nations have expressed deep concern about the scope of the NSA's global surveillance apparatus. In May of this year, the United Nations will audit the U.S.'s human-rights record under what is known as a universal periodic review. That audit—to be led by Botswana, Netherlands, and Saudi Arabia—is expected by some privacy advocates to include scrutiny of the NSA's mass spying.

The NSA began secretly scooping up massive troves of bulk Internet and phone data and content in 2007 through its PRISM program, which allowed for direct access to the systems of nine U.S. Internet giants, including Facebook, Google, and Apple. The program's existence was first publicly exposed in 2013 through top-secret government documents leaked by Edward Snowden.

PRISM and another program known as Upstream were challenged by an alliance of privacy groups, which argued that British authorities evaded civil-liberty protections by accessing the NSA's data stockpiles.

Those groups quickly cheered the tribunal's opinion and called it a vindication of Snowden's actions.

"For far too long, intelligence agencies like GCHQ and NSA have acted like they are above the law," said Eric King, deputy director of Privacy International, in a statement. "Today's decision confirms to the public what many have said all along—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."

King continued: "We must not allow agencies to continue justifying mass-surveillance programs using secret interpretations of secret laws. The world owes Edward Snowden a great debt for blowing the whistle, and today's decision is a vindication of his actions."

Privacy International and other civil-liberties groups said they would now push for clarification on whether the communications data stored before December 2014 must be deleted and would initiate further challenges to the British government's spying agreements with the U.S.

The NSA did not immediately respond to a request for comment.