A legal brief filed Friday by more than 20 organizations, including prominent medical associations such as the American Academy of Pediatrics, argues a federal regulation that would allow the indefinite detainment of migrant kids is “contrary to the best interests of children.”

The nonprofits and medical associations filed the brief as a federal judge considers whether to approve the regulation, proposed by the Trump administration, which would terminate the landmark 1997 Flores Agreement governing the care of migrant children in government custody.

The groups argue that detention, especially when prolonged, “is inherently harmful to children.”

The regulation would also eliminate what has become known as the “20-day rule,” a limit to the length of time migrant families with children could be held in detention. The 20-day limit stems from a 2017 decision in the Flores case, by Judge Dolly Gee, who still oversees the case in the U.S. District Court for the Central District of California.

Myra Jones-Taylor, chief policy officer at the child-development advocacy group Zero to Three, one of the organizations filing the brief, said in a statement to CBS News that “even under the best circumstances, and even with their families, placing infants and toddlers in detention centers is not an acceptable option.”

“Babies do not belong in detention. There is no simpler way to put it. For these young children, the rollback of the Flores Settlement Agreement paves the way for spending a significant time in family detention during a critical developmental period,” Jones-Taylor said.

The brief accuses the government of a “manifest intent … to detain children indefinitely.”

It’s a contention that was disputed by Acting Homeland Security Secretary Kevin McAleenan during an August 21 press conference announcing the regulation. McAleenan said there is “no intent” to hold families for “a very long time,” and suggested families would be in custody for an average of about 50 days.

The brief also criticizes a plan included in the regulation that would create an internal judicial system that would eliminate the role of immigration judges in evaluating whether kids are too dangerous, or too likely to flee, to be released.

The organizations argue in the brief that the new system of so-called 810 Hearings will prevent children from participating “meaningfully” in their own defense.

Judge Gee is expected to receive filings about the regulation from both the government and lawyers for the nation’s unaccompanied minors late Friday. She has not yet set a date to rule on the regulation.