The British spy agency said the legal frameworks around intelligence sharing were compatible with the law. (Daniel Acker/Bloomberg)

Britain’s electronic spy agency was acting unlawfully — until December — when it received intelligence provided by the U.S. National Security Agency, a British court ruled Friday.

The Investigatory Powers Tribunal, a court that oversees the intelligence and security agencies, said that Britain’s spy agency, GCHQ, was violating human rights when it received the intercepted communications from the NSA because it had not made details of the procedure and its safeguards on it public. In the tribunal’s 15-year history, this is the first time it has ruled against any of Britain’s intelligence agencies.

The court also said that while the lack of transparency in the past meant that GCHQ had breached human rights, the agency has been in compliance with the law since December.

The ruling comes at a time of heated debate in Britain over the balance between security and privacy, with Prime Minister David Cameron vowing to push for legislation to beef up security agencies’ surveillance powers if his party wins the upcoming general election.

In its ruling, the court said that “the regime governing the soliciting, receiving, storing and transmitting by UK authorities of private communications of individuals located in the UK” by the NSA breached Articles 8 or 10 of the European Convention on Human Rights, because GCHQ’s safeguards were kept secret. Article 8 refers to the right of privacy, while Article 10 covers freedom of expression.

In December, the tribunal said, the security agency made public the safeguards governing the exchanges with the NSA’s Prism and Upstream mass surveillance programs, making the exchanges lawful. The safeguards were disclosed as part of a separate legal challenge brought by civil liberty groups.

GCHQ said that the legal frameworks around intelligence-sharing were compatible with the law and that Friday’s ruling against it was, in essence, a technicality, or in “one small respect in relation to the historic intelligence-sharing regime. It also said that the ruling did not require it to change its operations.

The NSA and other U.S. officials declined to comment.

A GCHQ spokesman also said: “We are pleased that the court has once again ruled that the U.K.’s bulk interception regime is fully lawful.” He added, “Today’s IPT ruling re-affirms that the processes and safeguards within the intelligence-sharing regime were fully adequate at all times — it is simply about the amount of detail about those processes and safeguards that needed to be in the public domain. We welcome the important role the IPT has played in ensuring that the public regime is sufficiently detailed.”

The British government is “committed to transparency,” Britain’s Home Office said response to the ruling. “We have now made public the detail of the safeguards that underpin requests to overseas governments for support on interc

eption,” it said in a statement.

The latest legal challenge was brought by Privacy International, Amnesty International and other civil liberty groups, which applauded the ruling on Friday but also said they would appeal the earlier decision that the current system was now lawful to the European Court of Human Rights.

Eric King, deputy director of Privacy International, said that the ruling was a “vindication” of the actions of Edward Snowden, the former NSA contractor who leaked classified details about U.S. and British surveillance programs.

In a statement, he said, “For far too long, intelligence agencies like GCHQ and NSA have acted like they are above the law. 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.”

Ellen Nakashima in Washington contributed to this report.