The Trump administration last summer had no organized database linking the vast majority of migrant children separated from their families with their parents, despite the government's repeated statements that such a system was in place, emails obtained by NBC News show.

The emails are dated days after President Donald Trump officially ended his administration's "zero tolerance policy," which separated migrant families in an attempt to deter the number of migrants appearing at the U.S. border with Mexico. Initial tallies estimated that some 3,000 families were separated under the policy, but an investigation by the Department of Health and Human Services Office of the Inspector General earlier this year found that thousands more families were likely impacted.

"No, we do not have any linkages from parents to [migrant children], save for a handful," an analyst at HHS told an official at U.S. Immigration and Customs Enforcement in an email on June 23, 2018. "We have a list of parent alien numbers but no way to link them to children."

Matthew Albence, then the head of ICE's enforcement and removal operations and current acting head of the agency, replied to the email , saying, "Are you saying we don't have the alien number for any of the parents?" Immigration agencies track migrants using assigned numbers.

"Further, the type and volume of what you are requesting is not something we are going to be able to complete in a rapid fashion, and in fact, we may not have some of it," Albence added.

A federal judge on June 27, 2018, ordered the Trump administration to reunite all separated migrant families. Without a database, the officials began constructing a simple spreadsheet in an attempt to link separated children with their migrant parents.

The lack of an organized system linking migrant parents and children led to delays in reunification of parents and their kids. As many as 55 children are still separated from their parents.

A federal judge last week said he would give the Trump administration six months to manually comb through records and identify all children separated from their parents at the border. A government lawyer estimated that the process might take up to two years.

The emails also contradict statements made by members of the Trump administration after the policy came to light.

Facing questions from lawmakers and the public, officials repeatedly refuted claims that they had "lost" migrant children, or did not have an adequate database connecting parents and children.

An investigation by the Department of Homeland Security Office of the Inspector General last fall found that conversations with ICE employees indicated "no evidence" of a centralized database containing information on the location of separated migrant parents and children, NBC News noted.

