The Trump administration said Thursday it plans to circumvent a longstanding court agreement that governs how children are treated in immigration custody, in part to detain families longer as a way to deter migrants from crossing the Southwestern border illegally.

The Homeland Security Department announced proposed regulations that would terminate the so-called Flores agreement that requires the government to keep children in the least-restricted setting and required their release generally after 20 days in detention.

The 1997 case that spawned the agreement will almost certainly land back in court. U.S. District Court Judge Dolly M. Gee rejected a request by administration lawyers this summer to allow for longer family detention.

The agreement became an issue during a "zero-tolerance" policy enforced at the border to criminally prosecute anyone caught crossing illegally.

More than 2,900 children were separated from their parents, prompting international outrage and scathing criticism over what many said was inhumane treatment of migrants. Officials said children couldn't be in criminal custody with their parents, and were limited in how long they could detain families because of the agreement.

The government currently has three operational family detention centers, but most are at capacity.

However, Homeland Security asked for space to house 12,000 beds for families, plus space to house 20,000 unaccompanied minors. That process is moving forward; the Defense Department has completed legal and environmental requirements needed but they're still working on the legal framework for the use of Fort Bliss, in El Paso, Texas for immigrant families. The Department of Health and Human Services, which manages unaccompanied children crossing illegally, has not yet formally requested space for the minors, which it must do in order to set up the use.

The rules proposed Thursday would allow the government to hold families until their immigration cases were completed, a move that government officials contend makes cases go much faster than if families are released.

"Today, legal loopholes significantly hinder the department's ability to appropriately detain and promptly remove family units that have no legal basis to remain in the country," Homeland Security Secretary Kirstjen Nielsen. "This rule addresses one of the primary pull factors for illegal immigration and allows the federal government to enforce immigration laws as passed by Congress."

Immigrant advocates have opposed any effort to detain children longer than the agreement allows.

