The US government's justification for the NSA's Prism surveillance programme is set to be revealed following a legal battle launched by Yahoo.
The Internet giant's victory means that papers from a previous secret 2008 court case, believed to have been an important step in allowing the NSA to begin collecting data, declassified and published.
Yahoo claims that it fought vigorously against government requests to hand over customer's online data during the 2008 court case, and wants to prove this through the release of the documents.
Yahoo launched legal proceedings to have the case transcript published earlier this month through the Foreign Intelligence Surveillance Court (Fisc), which is responsible for granting the NSA's blanket powers.
The company also believes that the 2008 papers will shed further light on the US government's explanation of why such a sophisticated and invasive Internet surveillance system was needed.
"Once those documents are made public, we believe they will contribute constructively to the ongoing public discussion around online privacy," a Yahoo spokesperson said in a statement.
Government officials will now have the chance to review the papers and remove any "properly classified information" before publication, according to the ruling.
The court has given the US government until 29 July to say how long it will take to prepare the transcripts for release.
Top secret documents revealed by Edward Snowden last month claim that the NSA has direct access to the biggest Internet companies' servers through Prism, something that all, including Yahoo, have strongly denied having any knowledge of.
Last week it was revealed that Microsoft worked with the NSA to help the agency read encrypted messages collected through the program.