LOS ANGELES (Reuters) - A U.S. judge on Friday blocked a Trump administration rule that would have allowed indefinite detention of migrant families, saying it was inconsistent with a decades-old court settlement that governs conditions for migrant children in U.S. custody.

The 1997 settlement agreement, which originated in 1985 with a complaint brought on behalf of 15-year-old Salvadoran immigrant Jenny L. Flores, set standards for humane treatment of children in detention and ordered their prompt release in most cases.

The Trump administration had hoped a new rule issued on Aug. 23 would replace the settlement, which had been modified over the years to prevent the long-term detention of families. The administration had said its rule would allow families to be held in humane conditions while their U.S. immigration court cases were decided.

The judge disagreed.

“This regulation is inconsistent with one of the primary goals of the Flores Agreement, which is to instate a general policy favoring release and expeditiously place minors ‘in the least restrictive setting appropriate to the minor’s age and special needs,’” U.S. District Court Judge Dolly Gee in Los Angeles wrote in her ruling.

“The Flores Settlement Agreement remains in effect and has not been terminated,” she wrote.

U.S. President Donald Trump has made cracking down on immigration a hallmark of his presidency, and administration officials have repeatedly referred to the Flores agreement’s standards as “loopholes” that have attracted increasing numbers of mostly Central American families seeking U.S. asylum by forcing authorities to release them into the United States to wait for the outcome of their immigration hearings.

Slideshow ( 2 images )

The new regulation would have allowed the administration to hold families indefinitely during court processes that can take months or years because of large court backlogs. It had been due to go into effect next month.

In a court hearing in Los Angeles on Friday, Gee asked Department of Justice Attorney August Flentje how he could argue that the new regulations were not inconsistent with the terms of the Flores agreement.

“Just because you tell me it is night outside, doesn’t mean it is not day,” Gee said.

Lawyers for the Trump administration are expected to appeal. A Department of Justice spokesman said it was “disappointed that the court is continuing to impose the outdated Flores Agreement even after the government has done exactly what the Agreement required: issue a comprehensive rule that will protect vulnerable children, maintain family unity, and ensure due process for those awaiting adjudication of their immigration claims.”

The acting director of Immigration and Customs Enforcement, Matthew Albence, said earlier this week that family detention was just one tool available to the administration as it seeks to end what it calls “catch and release”. A policy that began this year of sending border crossers back to Mexico to wait for their immigration hearings is another, he said.

Albence and other administration officials have said the government would not be able to add to its around 3,300 family detention beds without additional funds being made available by the U.S. Congress.