Last July, 37 migrant children who had been separated from their parents at the border were driven to a detention center in Los Fresnos, Texas, to be reunited with their families. Before that could happen, though, the children were forced to wait nearly two days in a van, according to emails obtained by NBC News.

The children were sent to a shelter in Harlingen operated by the Department of Health and Human Services after being separated from their parents, who were held in Immigration and Customs Enforcement detention facilities near the border.

On July 15, the children were released from HHS custody and driven to the Port Isabel Detention Center by BCFS Health and Human Services, a nonprofit organization and government contractor. The trip was only supposed to take 30 minutes, according to the NBC report — but the parking lot was full of vans carrying other migrant children waiting to be processed.

“The children were initially taken into the facility, but were then returned to the van as the facility was still working on paperwork,” Andrew Carter, the BCFS regional director overseeing the process, said in an email to BCFS CEO Kevin Dinnin. “The children were brought back in later in the evening, but returned to the vans because it was too cold in the facility and they were still not ready to be processed in.”

At that point, the children had reportedly been waiting for eight hours.

BCFS staff claim ICE said that returning the children to the Harlingen shelter would lead to further delays. BCFS sent additional vans, as well as food and blankets from the Health and Human Services facility in Harlingen, Texas, where the children had previously been held, to the Port Isabel parking lot. HHS officials called ICE in the middle of the night to try to resolve the situation, NBC reported.

The first child was returned to their parents at 1:30 Monday morning, 11 hours after the van first arrived, according to emails between BCFS employees. The final child wasn’t processed until 5:50 a.m. on Tuesday, 39 hours after the van full of children arrived. Most children reportedly spent at least 23 hours in the vehicle.

In a statement to NBC, an ICE spokesperson called the incident “unusual.” After the “processing delays on July 15-16, which resulted in some children staying overnight in [Port Isabel], DHS took immediate action to resolve the situation and these delays were resolved,” the spokesperson said. “These children have all been reunited with their parents, and since then, no child has spent more than a few hours waiting to be reunited with their parents.”

A former HHS official told NBC that the Department of Homeland Security, which oversees ICE, was “clearly not ready to deal with the separations and did not take steps necessary to ensure a speedy reunification with their parents.”