The National Security Agency’s (NSA) surveillance program and the question of whether it violates the U.S. Constitution was in the works long before NSA contractor Edward Snowden’s revelations, and it has prompted an international discussion about surveillance and security rights.

A secret ruling by a U.S. district court judge recently released by the Obama administration reveals that the NSA violated the Constitution for three years by collecting tens of thousands of purely domestic communications without sufficient privacy protection, according to The Wall Street Journal.

In the strongly worded October 2011 ruling, Judge John Bates wrote: “For the first time, the government has now advised the court that the volume and nature of the information it has been collecting is fundamentally different from what the court had been led to believe.’’

More specifically, the court ruling disapproves of how the NSA collected Internet communications and phone data, noting estimates that suggest the NSA collected as many as 56,000 purely domestic communications a year. The court ruled the NSA’s Internet spy program was “in some respects, deficient on statutory and constitutional grounds.”

In addition, the court blamed the NSA for failing to implement other methods to decrease the amount of domestic data it collects.

“The government has failed to demonstrate that it has struck a reasonable balance between its foreign intelligence needs and the requirement that information concerning United States persons be protected,” Judge Bates added.

In June, Snowden leaked details of the classified surveillance operation to The Guardian and The Washington Post. The issue has prompted a global discussion about Internet privacy policies.

Earlier this summer, the E.U. Parliament voted overwhelmingly to investigate the privacy and civil rights implications of the NSA spy programs on European citizens, and to seek more information from U.S. authorities.