A US court has ordered the Obama administration to declassify a 2008 court decision justifying the Prism spying programme revealed last month by whistleblower Edward Snowden.

The ruling, issued earlier this week, will show how the state has legally justified its covert data collection programmes under the Foreign Intelligence Surveillance Act.

Judge Reggie Walton of the Foreign Intelligence Surveillance Court issued the ruling to declassify the decision. The government is expected to decide by August 26 which parts of the 2008 decision may be published.

The scope and scale of Prism, which collects millions of private foreign communications with American citizens, was leaked to the media last month by Snowden. Its operation is overseen by the FIS Court and its appeals body, the FIS Court of Review.

The ruling to declassify comes after a challenge by the internet firm, Yahoo, on the constitutionality of the programme.

It and a number of internet firms including Facebook, Google, AOL and Microsoft, were compelled to provide information to the National Security Agency (NSA), which runs Prism.

A statement from Yahoo on Tuesday said that 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," Yahoo said.

NSA sued

Meanwhile, 19 organisations represented by the Electronic Frontier Foundation (EFF) has filed a suit against the NSA for violating their right of association by illegally collecting their call records.

The coalition includes Unitarian church group, gun ownership advocates, and a broad coalition of membership and political advocacy groups.

"The First Amendment protects the freedom to associate and express political views as a group, but the NSA's mass, untargeted collection of Americans' phone records violates that right by giving the government a dramatically detailed picture into our associational ties," Cindy Cohn, the legal director for the EFF, said.

"Who we call, how often we call them, and how long we speak shows the government what groups we belong to or associate with, which political issues concern us, and our religious affiliation.

"Exposing this information – especially in a massive, untargeted way over a long period of time – violates the Constitution and the basic First Amendment tests that have been in place for over 50 years."

Data requests

Meanwhile a number of major US Internet companies, including Microsoft, Google and Facebook have asked the government for permission to disclose the number of national security-related user data requests they receive.

Also on Tuesday, Microsoft published an lengthy letter to US Attorney General Eric Holder asking for greater freedom to publicly discuss how it turns over user information to the government.

The letter was a response to a The Guardian newspaper report that said Microsoft had given authorities the ability to circumvent encryption of Outlook emails and to capture Skype online chats. The company says that report is inaccurate.