The National Security Agency on Friday cited a 1981 executive order signed by then-President Ronald Reagan as the authority under which it is collecting location data daily from tens of millions of cell phones around the world.

In a statement, the spy agency maintained that the data collection program, dubbed CO-TRAVELER, was solely about foreign communications and complies fully with restrictions in the Foreign Intelligence Surveillance Act (FISA).

"We are not intentionally acquiring domestic information through this capability. This collection does not violate FISA," the NSA stated.

The agency's statement is in response to a story in the Washington Post earlier this week describing one of the biggest NSA data collection programs revealed by Edward Snowden, the former NSA contractor turned document leaker.

Under the program, the NSA is collecting a staggering 5 billion location-related records from cell phones globally. Much of the data is gathered directly from the networks of major U.S. and overseas mobile service providers. Millions of those records are thought to belong to Americans who travel abroad with their cell phones.

The collected data is fed into a massive database from where it's combed with a suite of sophisticated analytic tools to help NSA analysts find cell-phone users who might be communicating or traveling with foreign intelligence targets.

The analytics suite includes tools that can map the date, time and location of individual cell phones around the world. Other tools help the NSA track the movements of large numbers of mobile devices and detect hidden relationships in the data.

News of the program has once again ignited protests from several quarters and is being seen as the most egregious example yet of the NSA's overreach in its effort to foil foreign terrorists. Groups like the Electronic Frontier Foundation and the American Civil Liberties Union have dubbed the data collection as unconstitutional and likened it to dragnet surveillance conducted without any legal authority.

In its statement Friday, the NSA however insisted that the program is fully authorized under Executive Order 12333 from 1981. The order directs U.S. intelligence agencies to develop foreign intelligence information for the president and the National Security Council. The order authorizes intelligence agencies to use "all means consistent with applicable United States law" to collect foreign intelligence information that is relevant to national security.

According to the NSA, the data collection described in the Post article falls under EO 12333 authorities.

"This is solely about foreign communications. NSA tries to avoid the acquisition of U.S. person communications during EO 12333 operations and also uses collection methodologies to comply with the restrictions in FISA," the agency said.

If the data collection results in the "incidental acquisition" of communications pertaining to a U.S. resident, the NSA applies data minimization procedures and, depending on the specific circumstances, destroy the data. Any data collected on U.S. residents has to be reported to the appropriate authorities, the agency noted.

"Again, the Agency's EO 12333 collection is outward-facing. FISA authorization would be required for the intentional collection of domestic metadata," the agency said.

The NSA also denied suggestions in the Post article that the agency has the capabilities to track the location of every cell phone in the world. The capability to track cell phones is not ubiquitous, the NSA noted.

"This capability has been used in some of the most dangerous parts of the world, including war zones, where terrorists are actively planning to do harm to the nation, " the NSA said. The only domestic intelligence program that involves bulk collection of data by the NSA falls under the purview of Section 215 of the USA Patriot Act pertaining to the collection of phone metadata records, the agency said.