Top-secret NSA documents provided to the Guardian by whistleblower Edward Snowden reveal the National Security Agency incurred millions of dollars in fees to major Internet companies including Facebook, Google, Microsoft and Yahoo involved in the Prism surveillance program.

According to the publication, the NSA was met with resistance following an October 2011 judgment that found the agency's inability to differentiate between domestic communications and foreign traffic violated the fourth amendment.

This unfavorable decision meant the NSA had to spend millions of dollars to bring select operations into compliance. The agency requires the signing of annual "certifications" via the Foreign Intelligence Surveillance Court as the framework for their operations but after the judgment, these certificates were only being renewed on a temporary basis.

It's these extensions that ultimately cost millions of dollars for Prism providers, the document revealed.

The paperwork further reveals the government is responsible for paying all costs associated with compliance from major Internet companies although it's unclear if any money was ever actually paid. In a statement on the matter, Facebook said they never received any compensation in connection with responding to a government data request.

A Yahoo spokesperson said federal law requires the US government to reimburse providers for costs incurred to respond to compulsory legal process imposed by the government. As such, they've requested reimbursement consistent with the law. Google and Microsoft declined to comment on the matter.

Perhaps the real kicker here is that the NSA used taxpayer money to initially cover the cost of compliance.