A secretive US court has granted Yahoo permission to publicly reveal its efforts to avoid becoming part of the National Security Agency's (NSA) controversial Prism data collection programme.

The Department of Justice has two weeks to state when Yahoo's fight against Prism will be published. (Credit: Reuters)

In an effort to clear its name and distance itself from the NSA snooping scandal, Yahoo claims the documents, which date from 2008, will demonstrate how the internet company "objected strenuously" to providing the government with data relating to its users.

Judge Reggie B. Walton of the US Foreign Intelligence Surveillance Court ruled that the government "shall conduct a declassification review of this Court's Memorandum Opinion of [Yahoo's case] and the legal briefs submitted by the parties to this Court."

The Department of Justice now has two weeks to estimate how long it will take to declassify the documents but retains the right to redact parts which it believes to still be too sensitive for public consumption.

In a statement released to the media, Yahoo said it was "very pleased" with the court's ruling. "Once those documents are made public, we believe they will contribute constructively to the ongoing public discussion around online privacy."

The ruling comes a day before Yahoo is to announce its earnings for the second financial quarter.

Violate the Fourth Amendment

Because the 2008 case was conducted under the Foreign Intelligence Surveillance Act (Fisa), details were never made public and Yahoo was not even allowed to reveal that it was involved in the case.

In June this year, sources told The New York Times that Yahoo had petitioned against the US Foreign Intelligence Surveillance Court in 2008 over concerns that complying with the NSA's order to work with Prism and grant access to user data would violate its users' Fourth Amendment rights against unreasonable searches and seizures..

At the time, the court responded to say Yahoo's concerns were "overblown" and that "incidentally collected communications of non-targeted US persons do not violate the Fourth Amendment."

On 10 July this year, Yahoo filed its request to disclose the 2008 court documents, stating that doing so would "allow Yahoo to demonstrate that it objected strenuously to the directives that are now the subject of debate, and objected at every stage of the proceedings, but that these objections were overruled and its request for stay [stopping a judicial proceeding through a court order] was denied."

Major US technology companies including Apple, Facebook, Google, Microsoft and Yahoo were accused last month of providing the NSA with direct access to user data stored on their servers through the Prism initiative, a situation made public by whistleblower and former NSA contractor Edward Snowden.

Each company strongly denied the allegations, with Yahoo calling them "categorically false."