A federal judge in California overturned part of an order requiring the National Security Agency to hang onto all phone record data gathered as part of its surveillance program.

Following an emergency hearing in Oakland Friday, U.S. District Judge Jeffrey White ruled the court cannot force the government to preserve all evidence in the case brought by the Electronic Frontier Foundation on behalf of Carolyn Jewel, just some of it, Courthouse News Service reported. White Thursday had ordered the government to stop destroying records of its spying on U.S. citizens.

The NSA said its databases automatically purge raw data on a two- to five-year cycle.

"Halting these purges and age-offs to preserve all Section 702 (of the Foreign Intelligence Surveillance Act Amendments Act) material, as we understand the court to have ordered, would require significant technical changes to these databases and systems and would have the effect of forcing NSA into non-compliance with FISC (Foreign Intelligence Surveillance Court)-approved minimization procedures, thus placing the entire program in legal jeopardy," the government brief argued.

The NSA said requiring it to change its system might necessitate a shutdown of systems, endangering its anti-terror efforts. It also noted an order requiring it to keep everything would violate rules ensuring the government would not keep the information forever.