FILE - In this Dec. 11, 2018 file photo, an asylum-seeking boy from Central America runs down a hallway after arriving from an immigration detention center to a shelter in San Diego. The Trump administration will make a case in court to end a longstanding settlement governing detention conditions for immigrant children, including how long they can be held by the government. A hearing is scheduled before a federal judge Friday, Sept. 27, 2019, in Los Angeles over the so-called Flores settlement. (AP Photo/Gregory Bull, File)

FILE - In this Dec. 11, 2018 file photo, an asylum-seeking boy from Central America runs down a hallway after arriving from an immigration detention center to a shelter in San Diego. The Trump administration will make a case in court to end a longstanding settlement governing detention conditions for immigrant children, including how long they can be held by the government. A hearing is scheduled before a federal judge Friday, Sept. 27, 2019, in Los Angeles over the so-called Flores settlement. (AP Photo/Gregory Bull, File)

LOS ANGELES (AP) — A U.S. judge on Friday blocked new Trump administration rules that would enable the government to keep immigrant children in detention facilities with their parents indefinitely.

U.S. District Court Judge Dolly Gee in Los Angeles said the rules conflict with a 1997 settlement agreement that requires the government to release immigrant children caught on the border as quickly as possible to relatives in the U.S. and says they can only be held in facilities licensed by a state.

Gee said the Flores agreement — named for a teenage plaintiff — will remain in place and govern the conditions for all immigrant children in U.S. custody, including those with their parents.

ADVERTISEMENT

“The agreement has been necessary, relevant, and critical to the public interest in maintaining standards for the detention and release of minors arriving at the United States’ borders,” the judge wrote in her decision.

“Defendants willingly negotiated and bound themselves to these standards for all minors in its custody, and no final regulations or changed circumstances yet merit termination of the Flores agreement.”

The Trump administration sought to end the agreement and issued the new rules with the hope of detaining immigrant children in facilities with their parents. The move came as part of a broader crackdown on asylum seekers arriving on the Southwest border, many of them families with children from Central America.

The Flores agreement allows for the settlement to be phased out when rules are issued for the custody of immigrant children that are consistent with its terms.

Attorneys who represent detained immigrant children welcomed Gee’s position, which she initially conveyed to them in a draft ruling during a court hearing Friday. They said they wouldn’t let the administration use young immigrants to try to deter migrants fleeing desperate conditions from seeking asylum in the United States.

“We will continue vigorously to defend the rights of detained immigrant children,” Neha Desai, director of immigration at the National Center for Youth Law, told reporters.

The Department of Justice said the administration is disappointed with the ruling because it did what was required to implement the new rules.

On Friday night, the White House issued a statement criticizing the judge’s ruling.

“For two and a half years, this Administration has worked to restore faithful enforcement of the laws enacted by Congress, while activist judges have imposed their own vision in the place of those duly enacted laws,” the statement said. “The Flores 20-day Loophole violates Congressional removal and detention mandates, creating a new system out of judicial whole cloth. This destructive end-run around the detention and removal system Congress created must end.”

Attorneys for both sides said they would be willing to meet and discuss whether some aspects of the rules aren’t subject to the settlement. Gee gave them until Oct. 4 to do so.

More than 400,000 immigrants traveling in family groups with children have been stopped on the Mexico border in the past year.

In its crackdown, the Trump administration has had migrants await immigration court hearings in Mexico and required those who cross through a third country to seek refuge there before applying for asylum in the U.S.

Immigrant advocates have decried the changes, which threaten asylum for many people fleeing violence in their countries.