The Obama administration on Tuesday released previously classified documents showing that National Security Agency employees routinely accessed a phone-records database without legal approval and misled a secret court about their actions.

The documents made public by Director of National Intelligence James Clapper show that NSA workers searched a database that held the phone records of Americans not connected to terror investigations. A judge on the top-secret Foreign Intelligence Surveillance Court ultimately ordered the NSA to make major changes to the program in 2009.

U.S. District Judge Reggie Walton wrote in the just-released opinion that he “lost confidence” in federal officials’ ability to properly oversee the program and was “deeply troubled by the incidents.”

Walton says that he even considered shutting down the program.

The data in question includes phone numbers dialed by Americans and the location of their calls but not the actual content of the conversations.

Just 2,000 of 17,835 phone numbers reviewed by NSA officials between 2006 and 2009 could be properly justified, officials acknowledged.

NSA officials conducted searches on thousands of phone numbers that did not meet court-ordered guidelines. At the time of the violations, the agency kept a wide swath of phone records, arguing that individuals could be on the receiving end of calls from terror suspects even if they were not suspected of a crime.

The admissions are only the latest in a series of troubling disclosures from the NSA following leaks from former government contractor Edward Snowden which revealed the extent of the agency’s secret surveillance programs

The classified documents were released on a day when most of Washington is focused on the debate over striking Syria, but the disclosures are likely to spark further congressional anger over privacy and calls for greater oversight.

The Obama administration has defended the NSA surveillance of phone and Internet traffic, arguing the programs have thwarted terror attacks and saved lives.

President Obama has announced steps he says will help bring greater oversight to the surveillance process and reassure the public that the government is striking the right balance between national security and privacy rights.

Director of National Intelligence James Clapper said the documents “demonstrate that the government has undertaken extraordinary measures to identify and correct mistakes that have occurred in implementing the bulk telephony metadata collection program – and to put systems and processes in place that seek to prevent such mistakes from occurring in the first place.”

Administration officials say the mishaps were inadvertent and that NSA employees didn’t understand the full scope of the program at the time.

But privacy advocates say the latest disclosures undercut claims by the administration that adequate safeguards are in place.

Congressional critics of the NSA's surveillance said the disclosures proved the agency relied on ineffective dragnet methods.

"We have said before that we have seen no evidence that the bulk collection of Americans’ phone records has provided any intelligence that couldn’t be gathered through less intrusive means and that bulk collection should be ended," Sens. Ron Wyden, D-Ore., and Mark Udall, D-Colo., said in a joint statement.

"These documents provide further evidence that bulk collection is not only a significant threat to the constitutional liberties of Americans, but that it is a needless one,” they added.

The NSA documents were made public after an open-records request by civil liberties groups.