The NSA collects nearly 5 billion records a day on the locations of cell phones overseas to create a huge database that stores information from hundreds of millions of devices, including those belonging to some Americans abroad, the Washington Post reported Wednesday.

Documents provided to the Post by NSA leaker Edward Snowden detail how this database is able to track people worldwide and map out their relationships with others.

The NSA inadvertently gathers U.S. location records, along with the billions of other records it collects by tapping into worldwide mobile network cables, the Post reported.

The database and projects designed to analyze it have created a mass surveillance tool for the NSA, allowing it to monitor individuals in a way never seen before.

NSA analysts can look at the data and track an individual’s movements throughout the world. They can then map out the person's relationships with others and expose previously unknown correspondence.

The agency collects the large amount of cell phone data in order to find out who is interacting with targets the agency is already tracking, even though most of the records collected are not relevant to national security.

The number of Americans who are tracked as part of the data collection overseas is unclear from the Snowden documents, and a senior intelligence official told the Post it is “awkward for us to try to provide any specific numbers.”

U.S. officials told the Post the programs that collect cell phone data are strictly geared towards tracking foreign intelligence targets, and are not against the law.

The Associated Press contributed to this report