The National Security Agency (NSA) on Friday announced it has been deleting hundreds of millions of records of phone calls and text messages dating back to 2015.

Due to "technical irregularities" in its data, the agency said, it possessed certain records it had no authority to receive. As of May 23, the NSA began deleting all of this type of records that were collected after 2015 under the Foreign Intelligence Surveillance Act (FISA), just to be safe.

"Because it was infeasible to identify and isolate properly produced data, NSA concluded that it should not use any of the [call detail records]. Consequently, NSA, in consultation with the Department of Justice and the Office of the Director of National Intelligence, decided that the appropriate course of action was to delete all" records collected u, the NSA said in a statement.

The NSA is authorized to collect certain data from telecom companies under Title V of FISA and through the USA Freedom Act of 2015. Under the Freedom Act, bulk data about U.S. phone calls and text messages remains in the hands of telecom companies. The NSA is only permitted to collect very specific data, such as call records of surveillance targets and their contacts or of those suspected of terrorism, according to the New York Times.

Read the NSA's full statement below.

Consistent with NSA’s core values of respect for the law, accountability, integrity, and transparency we are making public notice that on May 23, 2018, NSA began deleting all call detail records (CDRs) acquired since 2015 under Title V of the Foreign Intelligence Surveillance Act (FISA).

The Government relies on Title V of FISA to obtain CDRs, which do not include the content of any calls. In accordance with this law, the Government obtains these CDRs, following a specific court-authorized process.

NSA is deleting the CDRs because several months ago NSA analysts noted technical irregularities in some data received from telecommunications service providers. These irregularities also resulted in the production to NSA of some CDRs that NSA was not authorized to receive. Because it was infeasible to identify and isolate properly produced data, NSA concluded that it should not use any of the CDRs. Consequently, NSA, in consultation with the Department of Justice and the Office of the Director of National Intelligence, decided that the appropriate course of action was to delete all CDRs. NSA notified the Congressional Oversight Committees, the Privacy and Civil Liberties Oversight Board, and the Department of Justice of this decision. The Department of Justice, in turn, notified the Foreign Intelligence Surveillance Court. The root cause of the problem has since been addressed for future CDR acquisitions, and NSA has reviewed and revalidated its intelligence reporting to ensure that the reports were based on properly received CDRs.