The Trump administration’s “zero tolerance” crackdown at the border this spring was troubled from the outset by planning shortfalls, widespread communication failures and administrative indifference to the separation of small children from their parents, according to an unpublished report by the Department of Homeland Security’s internal watchdog.

The report, a copy of which was obtained by The Washington Post, is the government’s first attempt to autopsy the chaos produced between May 5 and June 20, when President Trump abruptly halted the separations under mounting pressure from his party and members of his family.

The DHS Office of Inspector General’s review found at least 860 migrant children were left in Border Patrol holding cells longer than the 72-hour limit mandated by U.S. courts, with one minor confined for 12 days and another for 25.

Many of those children were put in chain-link holding pens in the Rio Grande Valley of southern Texas. The facilities were designed as short-term way stations, lacking beds and showers, while the children awaited transfer to shelters run by the Department of Health and Human Services.

U.S. border officials in the Rio Grande Valley sector, the busiest for illegal crossings along the nearly 2,000-mile U.S.-Mexico border, held at least 564 children longer than they were supposed to, according to the report. Officials in the El Paso sector held 297 children over the legal limit.

The investigators describe a poorly coordinated interagency process that left distraught parents with little or no knowledge of their children’s whereabouts. In other instances, U.S. officials were forced to share minors’ files on Microsoft Word documents sent as email attachments because the government’s internal systems couldn’t communicate.

“Each step of this manual process is vulnerable to human error, increasing the risk that a child could become lost in the system,” the report found.

Based on observations conducted by DHS inspectors at multiple facilities along the border in late June, agents separated children too young to talk from their parents in a way that courted disaster, the report says.

“Border Patrol does not provide pre-verbal children with wrist bracelets or other means of identification, nor does Border Patrol fingerprint or photograph most children during processing to ensure that they can be easily linked with the proper file,” the report said.

“It is a priority of our agency to process and transfer all individuals in our custody to the appropriate longer-term detention agency as soon as possible,” U.S. Customs and Border Protection, which includes Border Patrol, said in a statement. “The safety and well-being of unaccompanied alien children . . . is our highest responsibility, and we work closely with the Department of Health and Human Services (HHS) Office of Refugee Resettlement to ensure the timely and secure transfer of all unaccompanied minors in our custody as soon as placement is available from HHS.”

In its Sept. 14 response to the inspector general’s report, DHS acknowledged the “lack of information technology integration” across the key immigration systems and “sometimes” holding children beyond the 72-hour limit.

Jim Crumpacker, the DHS official who responded to the report, said the agency held children longer mainly because HHS shelter space was unavailable. But he said transferring children to less-restrictive settings is a priority.

On June 23, three days after the executive order halting the separations, DHS announced it had developed a “central database” with HHS containing location information for separated parents and minors that both departments could access to reunite families. The inspector general found no evidence of such a database, the report said.

“The OIG team asked several [Immigration and Customs Enforcement] employees, including those involved with DHS’ reunification efforts at ICE Headquarters, if they knew of such a database, and they did not,” it states. “DHS has since acknowledged to the OIG that there is no ‘direct electronic interface’ between DHS and HHS tracking systems.”

Inspectors said they continue to have doubts about the accuracy and reliability of information provided by DHS about the scope of the family separations.

In late June, a federal judge ordered the government to reunite more than 2,500 children taken from their parents, but three months later, more than 100 of those minors remain in federal custody.

The inspector general’s report also found that U.S. Customs and Border Protection (CBP) restricted the flow of asylum seekers at legal ports of entry and may have inadvertently prompted them to cross illegally. One woman said an officer had turned her away three times, so she crossed illegally.

At one border crossing, the inspection team saw CBP attempt to increase its detention space by “converting former offices into makeshift hold rooms.”

The observations were made by teams of lawyers, inspectors and criminal investigators sent to the border amid concerns raised by members of Congress and the public. They made unannounced visits to CBP and ICE facilities in the border cities of El Paso and McAllen, Tex.