The empty beds were revealed in court documents late last month. Lawyers who monitor U.S. Immigration and Customs Enforcement’s facilities said two major facilities were running well below capacity.

Although the beds were empty, the government was still paying for them.

The contractor who operates Dilley “is paid a flat rate of $3.1 million per month to operate the facility regardless of the number of residents, which means that the government saves no money in reducing the number of families processed at the facility,” Wendi Warren H. Binford, a law professor at Willamette University in Oregon, wrote in a sworn declaration to a federal court two weeks ago.

The vacancies are the latest perplexing facet of the administration’s immigration policy, which, while taking a get-tough approach rhetorically, has been plagued by questionable decisions, policy reversals and confusion.

“It’s a mystery why they would not want to use this space available,” said Jessica Vaughan, policy studies director at the Center for Immigration Studies, which advocates for stricter enforcement. “If they have the detention capacity, they should be using it.”

The space is about to become even more important.

The Trump administration is rushing to reunite as many as 2,500 more children who were separated from their parents in the confusion surrounding the president’s zero-tolerance border policy.

The government released more than 50 young children and their parents after reuniting them last week. They were put into an “Alternatives to Detention” program, which usually means either an ankle monitoring device or a program of check-ins designed to make sure they return for their deportation hearings.

That often doesn’t happen, said officials with U.S. Immigration and Customs Enforcement.

“That is not an effective removal tool,” Matthew Albence, a top deportation official, told reporters this month.

Security analysts say detention is the best way to ensure people appear for their court cases and deportation times.

ICE said it couldn’t comment on the empty beds because the information was filed as part of a series of ongoing court cases.

But one Homeland Security official indicated they believe their hands are tied by a court case, the Flores settlement.

“We are in compliance with the court order,” the official said.

That 1997 Flores settlement, which originally required the speedy release of children who arrived at the border alone, was updated by Judge Dolly Gee in 2015 to apply to children who come with their parents. Under the new rules, children can be held in ICE custody for only about 20 days.

Since deportation cases usually take longer than that, the 20-day deadline means the children have to be released into communities. The government usually wants to place children with parents, so it releases the entire family.

President Trump ordered his attorneys to challenge the Flores settlement and ask Judge Gee for a rethink.

Those lawyers told Judge Gee that they believe a ruling by another federal court, Judge Dana Sabraw, who set timelines for reunification of families, envisions families being detained together, even beyond 20 days. The administration said that is what it intends to do.

“The government will not separate families but detain families together during the pendency of immigration proceedings when they are apprehended at or between ports of entry,” the Justice Department said in late June.

Judge Gee rejected those arguments and said her 20-day guidelines remain in effect.

That leaves the government struggling to adopt the strictest policy possible within the guidelines set by myriad judges.

Peter Schey, the lawyer representing the children in the Flores settlement, said the unused space suggests that the government is wrongly claiming an illegal immigration crisis.

He questioned the terms of the contract that pays out regardless of how much space the government is using.

“It is shameful that major corporations are reaping massive profits operating family detention centers and being paid tens of millions of dollars regardless of the number of families actually housed and serviced in these facilities,” Mr. Schey said.

He said the administration could end the contracts and instead use group homes that have been licensed by the federal Housing and Urban Affairs Department and local governments.

The administration runs three family detention facilities, totaling 3,326 beds, according to a Government Accountability Office report this year.

The facility in Dilley is the biggest at 2,400 beds, followed by another Texas facility in Karnes. A third, small facility in Pennsylvania, the Berks Family Residential Center, has fewer than 100 beds.

For years, the government had only Berks, but when the number of illegal immigrant children and families surged in 2014, the Obama administration scrambled to open the other two facilities in Texas.

The facilities have been a target for immigrant rights activists who oppose detention of most illegal immigrants, and of families in particular. The government’s chief watchdog, the GAO, questioned the government’s budgeting decisions in its report this year.

The Dilley facility’s contract nears $40 million a year.