The National Security Agency violated court orders and improperly accessed data on thousands of phone numbers for years, according to court documents released Tuesday by the Obama administration.
The NSA notified the Foreign Intelligence Surveillance Court in January 2009 that analysts had been viewing phone records without proper approval since 2006.
"The court is exceptionally concerned about what appears to be a flagrant violation of its order," FISC Judge Reggie Walton wrote.
As a result of the violation, the FISC tightened its oversight of the NSA in 2009, but loosened the restrictions later that year.
In a statement, Director of National Intelligence James Clapper said the violations were inadvertent and that the agency has instituted reforms to prevent similar mistakes.
He said the violations stemmed from the "complexity of the technology" involved in the phone data program and poor communication within the NSA.
"As discussed in the documents, there was no single cause of the incidents and, in fact, a number of successful oversight, management, and technology processes in place operated as designed and uncovered these matters," he said.
Leaks by Edward Snowden revealed earlier this year that the NSA collects records, such as phone numbers, call durations and times, on virtually all U.S. phone calls. Analysts are only allowed to search the vast phone database if they have a "reasonable articulable suspicion" that a phone number is connected to terrorism.
But the NSA acknowledged in early 2009 that since the program had begun, analysts were comparing thousands of numbers without any suspicion that they were connected to terrorists.
Analysts claimed that they thought the privacy restrictions only applied to "archived data," but in a ruling, Judge Walton wrote that "that interpretation of the Court's Order strains credulity."
The court then pulled the NSA's authority to search the phone database on its own, requiring that the agency receive court approval on a case-by-case basis except for imminent threats to human life.
The NSA said it then implemented an "end-to-end" review of its phone data program and fixed the compliance problems "through a series of technological fixes and improved training."
The court authorized the NSA to resume searching the database on its own in September 2009.
The government released the documents after being sued under the Freedom of Information Act by the American Civil Liberties Union and the Electronic Frontier Foundation.
Clapper said the release was part of the administration's effort to increase transparency without harming national security.
— This story was updated at 5:55 p.m.