Nineteen states and the District of Columbia are suing the Trump administration over its plan to pull out of a decades-old court settlement that governs the care of migrant children in federal detention.

The federal government has abided by a court agreement known as the Flores settlement since 1997. It says migrant children should be detained in the least restrictive setting possible and only for about 20 days. Last week the Trump administration announced it will soon detain children with their families indefinitely.

The states, led by California and Massachusetts, argue that the government is already failing to provide detained children with safe and sanitary conditions. (Earlier this month the 9th U.S. Circuit Court of Appeals ruled that detained children should receive adequate food, clean water and basic hygiene.) Their suit also says the government plan will have a negative long-term impact on the detained children if they are held indefinitely.

"This new Trump rule callously puts at risk the safety and well-being of children," said California Attorney General Xavier Becerra in a statement. "No child deserves to be left in conditions inappropriate and harmful for their age. We're taking the Trump Administration to court to protect children from the irreparable harm caused by unlawful and unnecessary detention."

The states also say the administration's plan will result in an expansion of family detention centers that are not licensed by the states. The administration says it will set its own standards for care — in effect, licensing itself.

"With this rule, the Trump Administration is paving the way for [Immigration and Customs Enforcement] to imprison innocent children for indefinite periods of time and is attempting to take away the ability of states to stop them," said Massachusetts Attorney General Maura Healey.

Becerra and Healey are Democrats.

The Justice Department has not yet responded for a request for comment.

Copyright 2019 NPR. To see more, visit https://www.npr.org.