WASHINGTON (AP) — The Trump administration is moving to end a long-standing federal court agreement that limits how long immigrant children can be kept in detention, a decision that will almost certainly lead to a new court fight over the government’s ability to hold migrant families until their cases are decided.

Ending the so-called Flores agreement is a top priority for the Trump administration. It requires the government to keep children in the least restrictive setting and to release them as quickly as possible, generally after 20 days in detention. Homeland Security officials say they are adopting regulations that reflect the agreement and there is no longer a need for court involvement, which was only meant to be temporary.

The move is the latest effort by the administration to restrict immigration, President Donald Trump’s signature issue, and is aimed at restricting the movement of asylum seekers in the country and deterring more migrants from crossing the border. It is bound to generate fresh outrage, following reports of dire conditions in detention facilities, and it is questionable whether courts will let the administration move forward with the policy.

Peter Schey, a lawyer for the immigrant children in the Flores case and president of the Center for Human Rights and Constitutional Law, said if the regulations don’t match the settlement, “they would be in immediate material breach, if not contempt of court.”

“I think all these things are now part of the 2020 campaign,” Schey said.

The officials said they are creating a set of higher standards to govern family detention facilities, which will be regularly audited, and the audits made public. But the rules would allow the government to hold families in detention until their immigration cases are completed, which could be much longer than 20 days.

The officials spoke to reporters on condition of anonymity to discuss regulations that had not been made public.

The regulations were expected to be formally published Friday and go into effect in 60 days absent legal challenges.

They follow moves last week to broaden the definition of a “public charge” to include immigrants on public assistance, potentially denying green cards to more immigrants. There was also a recent effort to effectively end asylum altogether at the southern border.

Flores is a constant talking point by the president and his administration, which claims it is an immigration loophole that encourages migrants to make a dangerous and potentially deadly journey to the U.S. The district judge overseeing the agreement has already refused government requests to increase the amount of time children can be detained, and advocates have already moved to block the regulations when the proposed rule was first announced last September.

Parents and children coming into the country are often released into the U.S. while their asylum requests wind their way through the courts — a practice Trump has derided as “catch-and-release.”

Homeland Security did not say how long it expects families to be kept. Asylum cases involving detained families move much more quickly than cases for families released, taking months instead of years to resolve, in part because there are none of the delays that result when immigrants set free in the U.S. fail to show up for a hearing.

The government operates three family detention centers that can hold a total of about 3,000 people, though one is being used for single adults, and the other two are at capacity. Officials hope they would not need extra bed space because the rules would serve as a deterrent.

The massive influx of Central American families to the U.S.-Mexico border has vastly strained the system, though agreements by Mexico to clamp down on migrants heading north and a new agreement with Guatemala forcing migrants to claim asylum there instead of heading north are expected to reduce the flow, though the action has been decried as inhumane.

Trump administration officials have also forced more than 30,000 people to wait out their asylum cases in Mexico while their cases progress. It’s not clear how this change would affect that policy.

Lawyers in the Flores case recently spoke out about what they said were deplorable, filthy conditions for children held at border facilities not meant to hold large groups of people for very long.

And a recent report by an independent monitor overseeing claims of government noncompliance with Flores rules detailed the extreme overcrowding and poor conditions that immigrant youths faced in detention.

For example, a Border Patrol station in in Clint, Texas, an El Paso suburb, had a capacity for 105 children. On June 1, there were 676. Lawyers who visited that facility in June described squalid conditions. Children cared for toddlers, the lawyers said, adding that they had inadequate food, water and sanitation.

At a detention center in McAllen, Texas, there were nearly 1,800 juveniles when the entire capacity for both juveniles and adults was 1,500.

The monitor in the Flores settlement visited some facilities, finding that they were as cold as 66 degrees Fahrenheit (19 degrees Celsius), and “even participants in the inspection and dressed in business clothes often found the temperature uncomfortably cool.”

A federal appeals panel found last week that detained children should get edible food, clean water, soap and toothpaste under the agreement, after a bid to limit what must be provided.

The Flores agreement has been into effect since 1997 but mostly applied to children who came to the country alone. In 2015, U.S. District Court Judge Dolly Ghee ruled the requirements were applicable to children who crossed the border with families, after the Obama administration tried to detain them together until their cases were completed.

Part of the issue was that children could not be kept in facilities that weren’t licensed, and no states license family detention centers. Homeland Security officials say by adopting the standards for education, healthy food and cleanliness used by U.S. Immigration and Customs Enforcement, which detains adult immigrants, they are satisfying requirements in lieu of state licensing requirements.

The agreement surfaced again in the spring of 2018, when the Trump administration adopted a policy of prosecuting anyone caught crossing illegally. More than 2,900 children were separated from their parents as a result.

Trump eventually backed down and stopped the separation of families. A federal judge ordered parents and children reunited; the government has said it has done so in as many cases as it could.