The National Security Agency (NSA) is purging what appears to be hundreds of millions of phone records collected by U.S. telecom companies that the agency had acquired since 2015.

The agency released a statement on Thursday saying it began deleting records in May after "analysts noted technical irregularities in some data received from telecommunications service providers."

The records date back to 2015 and were obtained under the Foreign Intelligence Surveillance Act.

The statement added that "the root cause of the problem has since been addressed" for future call record collecting.

In a written follow-up statement to the Associated Press, the NSA said it is "following a specific court-authorized process," but technical irregularities resulted in the production of some call records that the NSA "was not authorized to receive."

The NSA faced a legal battle surrounding its Internet surveillance data collection program in 2017, when the 4th U.S. Circuit Court of Appeals ruled that a challenge brought by the American Civil Liberties Union could move forward.

David Kris, a member of the Justice Department during the Obama administration, told the New York Times that the agency's announcement represents a "failure" of the Obama administration to properly implement the Freedom Act, a surveillance law passed in 2015 after the controversial Patriot Act expired.

Others placed the blame elsewhere.

“Telecom companies hold vast amounts of private data on Americans,” Sen. Ron Wyden, D-Ore., told the Times. “This incident shows these companies acted with unacceptable carelessness, and failed to comply with the law when they shared customers’ sensitive data with the government."

The Associated Press contributed to this report.