A previously top-secret exchange between the National Security Agency and the court that oversees its surveillance activities is now public. The NSA yesterday declassified a 2011 ruling in which the court said that one aspect of the NSA's surveillance program was both illegal and unconstitutional. The violations were later corrected, but not before the surveillance court delivered some harsh criticism of the NSA's performance.

NPR's Tom Gjelten has more.

TOM GJELTEN, BYLINE: Word that the surveillance court had secretly ruled against the NSA came only after intelligence officials quietly acknowledged it, a year after the fact. That allowed Senator Ron Wyden of Oregon to mention the ruling during a speech on the Senate floor.

SENATOR RON WYDEN: On at least one occasion the FISA court has ruled that collection carried out by the government under the FISA Amendments Act violated the Fourth Amendment to the Constitution.

GJELTEN: But no one without a security clearance knew what Wyden was referring to. Now we know from court documents that each year, from 2008 to 2011, the NSA may have collected more than 50,000 emails sent between people in the United States with no foreign connection. This is strictly prohibited under the FISA law, which authorizes the interception of emails only for the purpose of foreign intelligence gathering.

The NSA alerted the court to the problem, saying the violation was unintentional and arose from the difficulty, in some cases, of separating foreign and domestic email communication.

But the court said that was no excuse. And the language of the opinion made clear the chief judge was not happy. The volume and nature of the information the government has been collecting, the court said, is quote, "fundamentally different from what the court had been led to believe." Moreover, the chief judge noted it was the third time in three years the NSA had to admit some of its surveillance activities were out of bounds.

Other court rulings released yesterday showed the NSA made an effort to correct the problems that led to its illegal intelligence gathering, and the surveillance court approved those fixes. The court's willingness in the end to approve the NSA surveillance program, as corrected, has now brought criticism from the American Civil Liberties Union. In a statement the ACLU said the court's approval of the program shows that current oversight mechanisms, quote, "are far too feeble."