Migrants build makeshift tents with blankets to protect themselves from the cold as an American helicopter guards the border in Ciudad Juarez, Mexico, on March 26, 2024.
CNN  — 

Migrant children held in open-air desert camps are in federal custody and required to be expeditiously processed and placed in “facilities that are safe and sanitary,” a federal judge in California said in a court order late Wednesday.

Judge Dolly Gee wrote that US Customs and Border Protection does maintain legal custody over the minors in the open-air detention sites and has “decision-making authority over the health and welfare” of the children at those sites.

Thousands of asylum seekers — from countries ranging from Mexico and Venezuela to China and India — have made their way to makeshift camps in remote sections of the California desert since last spring. That includes dozens of children.

In a court document filed in late February, children’s rights attorneys argued that federal immigration officials directed migrants to those camps but failed to provide adequate food, water, shelter, and medical services.

The Biden administration, however, argued that the minors had not been arrested by CBP and were therefore not in the legal custody of the agency.

But the attorneys said in filings that Border Patrol’s actions demonstrate that the agency has assumed authority over the migrants, pointing to agents regularly patrolling the camps, watching them with surveillance cameras and transporting migrants to the tents. Attorneys added that agents placed wrist bands on migrants, conducted body searches, told them where to stand and threatened them with losing their chance at asylum if they leave.

Gee concluded Wednesday that CBP should not hold minors in or direct them to “open-air sites, except for the amount of time DHS reasonably requires to prepare the minor and/or actively arrange for transport of the minor to a more suitable facility, as this behavior constitutes unnecessary delay.”

“U.S. Customs and Border Protection is reviewing the court’s order. CBP will continue to transport vulnerable individuals and children encountered on the border to its facilities as quickly as possible,” a CBP spokesperson said in a statement.

Gee also ordered the CBP Juvenile Coordinator to file an interim report by May 10 with an update on the number of minors held in open-air sites and how the agency has complied with the order. The attorneys will then have six days to respond to the interim report.

This story has been updated with additional developments.