WASHINGTON – A recently revealed National Security Agency program that searches the contents of Americans' international Internet communications for people who mention foreigners under surveillance violated the Constitution for several years, according to an October 2011 top-secret court ruling made public Wednesday.

The 85-page ruling by Judge John Bates, then serving on the Foreign Intelligence Surveillance Court, held that the NSA was mishandling as many as tens of thousands of unrelated and purely domestic communications it was picking up — on U.S. soil and without warrants — as a consequence of filtering Internet data for such messages.

Fixed the problems

The release of the ruling, under pressure by a Freedom of Information Act lawsuit brought by the Electronic Frontier Foundation, was the latest effort by the Obama administration to contain revelations about NSA surveillance prompted by leaks by the former NSA contractor Edward Snowden. Director of National Intelligence James Clapper authorized the release.

The documents showed that the problems were relatively small when compared with the vast scale of NSA surveillance conducted from the United States on noncitizens abroad. The ruling estimated that the agency intercepts more than 250 million communications that way each year. And the NSA fixed the problems to the court's satisfaction, the documents showed.

'The Court is troubled'

But the documents also revealed further problems. In particular, Bates portrayed the issue, which the NSA had brought to the secret surveillance court's attention after discovering that it had been happening for several years, as part of a broader pattern of misleading the oversight court about its domestic spying activities. "The Court is troubled that the government's revelations regarding NSA's acquisition of Internet transactions mark the third instance in less than three years in which the government has disclosed a substantial misrepresentation regarding the scope of a major collection program," he wrote.

The judge also wrote that the NSA had advised the court that "the volume and nature of the information it had been collecting is fundamentally different than what the court had been led to believe," and went on to say the court must consider "whether targeting and minimization procedures comport with the 4th Amendment."

The Associated Press contributed to this report.