A coalition of 19 states and the District of Columbia, led by California and Massachusetts, said on Monday they will sue the Trump administration to stop a sweeping new rule to indefinitely detain migrant families seeking to settle in the United States.

The lawsuit, which is to be filed in federal court in California, will be only the first of what is expected to be a flurry of lawsuits aimed at blocking the rule, officially published on Friday, from taking effect in October.

However, the Trump administration's effort to overturn a two-decade-old legal settlement limiting how long migrant children can be detained is likely to face more than just legal hurdles.

Even if the courts allow the rule to take effect, there are also practical problems: paying for thousands of additional family detention beds.

Challenge: California Attorney General Xavier Becerra said in a statement on Monday that attempt to tear up limits on detaining child migrants is unlawful and 'callously puts at risk the safety and well-being of children.'

Border law: The Flores Settlement has governed how children who cross into the U.S. can be dealt with for 20 years

Detention facility: ICE opened its doors to its South Texas Family Residential Facility where 900 mothers and children are held together

Shortage of space: The detention center in Dilley, TX, is one of only three which exist in the U.S. where children can be housed. But more than 42,000 families, mostly from Central America, were arrested along the U.S. southern border just last month

U.S. Immigration and Customs Enforcement has only three family detention facilities - two in Texas and one in Pennsylvania - that have between 2,500 and 3,000 beds, Acting Secretary of Homeland Security Kevin McAleenan said in announcing the new rule last week.

More than 42,000 families, mostly from Central America, were arrested along the U.S. southern border just last month. The July arrest numbers are at record highs, even though they have dropped more than half compared with levels seen in May.

'Even if the number of border crossings doesn't go back up in the fall, all this (new rule) would enable them to do is to detain a relatively small percentage of the arriving families for longer,' said Kevin Landy, a former ICE assistant director responsible for the Office of Detention Policy and Planning under the Obama administration.

THE RULES ON DETAINING ILLEGAL MIGRANT KIDS TRUMP WANTS TO CHANGE Since 1997, what happens to children who cross the border illegally has been determined by a court settlement made by the Clinton administration to end a long-running case brought on behalf of a group of children detained at the border in 1985. It got its name from one of them - Jenny Lisette Flores - and when the Clinton administration ended the federal litigation by negotiation, became known as the Flores Settlement. It set a 20 day limit on detaining children, and said that they had to be released to their parents or suitable guardians. The federal government has to offer 'food and drinking water as appropriate,' 'medical assistance if minor is in need of emergency services,' 'toilets and sinks,' 'adequate temperature control and ventilation,' 'adequate supervision to protect minors from others,' 'contact with family members who were arrested with the minor and separation from unrelated adults whenever possible.' If a relative or guardian could not be found, they had to be sent to homes, not other detention centers - 'the least restrictive environment possible,' the agreement specified. The settlement was temporary, And it contained a poison pill: the only way to end the settlement was to come up with formal immigration rules which met the minimum conditions in the settlement and to which the federal court overseeing the settlement agreed. Since then it has been back in court repeatedly, with the Bush and Obama administration accused of breaching it. This month a judge ruled that it guarantees that detained children have a right to toothpaste, after the Trump administration suggested it was optional. THE CHANGE The Homeland Security department did not publish the details of its new rule Wednesday but claimed it would be a full-scale replacement of Flores which would allow indefinite detention. That would mean it has to embrace the other aspects of Flores - meaning the conditions under which children are kept will have to be as described in the deal and subsequent rulings. How the Department of Homeland Security thinks it will get indefinite detention passed is unclear. Advertisement

Shawn Neudauer, a spokesman for ICE, said the agency could not comment on potential increases to the agency's detention capacity.

The new rule seeks to scrap the 1997 agreement, known as the Flores settlement, which puts a 20-day limit on how long children can be held in immigration detention.

The court overseeing the settlement expanded its interpretation in 2015 to apply not just to unaccompanied children but also to children traveling with their parents.

Trump administration officials have said the detention limits have become a 'pull' factor for migrants who bet that if they show up at the U.S.-Mexico border with a child and ask for asylum, they will be quickly let go to wait for a hearing in U.S. immigration court. Trump has decried this as a 'catch-and-release' practice.

Without more space, that practice is likely to continue, Landy said.

'The longer they keep those families, the fewer new arrivals they can detain, which means the Border Patrol is releasing more people overall' while a small percentage of families suffer the impacts of prolonged detention, he said.

California Attorney General Xavier Becerra said in a statement on Monday that the rule is unlawful and 'callously puts at risk the safety and well-being of children.'

McAleenan last week said ICE's family facilities meet 'high standards' including appropriate medical, educational, recreational and dining operations and private housing.

Setting up those types of 'family residential centers,' as the agency calls them, can be more expensive than facilities dedicated only to adults.

Congress mandates how much ICE can spend on immigration detention, and the 2019 budget has $2.8 billion earmarked to pay for 49,500 beds for solo adults - but only 2,500 beds for parents and children.

However, ICE is currently detaining more than 55,000 immigrants, a record high, a small percentage of them at family facilities, according to agency statistics.

The Department of Homeland Security has been able to stretch its budget by reprogramming funds from other areas to pay for more detention, but there are limits on how much money it can move without congressional approval.

Democrats in Congress are trying to put more limits on ICE's detention spending for the next fiscal year.

Congresswoman Nita Lowey, a New York Democrat who chairs the U.S. House of Representatives' Appropriations Committee, said the aim of proposed controls in the 2020 budget is to 'tighten the reins on the administration's practice of transferring funds for purposes other than those intended by Congress, including the dramatic expansion of interior immigration enforcement.'

ICE has also had a hard time finding communities willing to accept the construction of facilities in their backyards, said Theresa Cardinal Brown, a former policy adviser at U.S. Customs and Border Protection now at the Washington-based Bipartisan Policy Center.

It is also not clear how the family detention rule will work with another Trump administration policy pushing thousands of Central American families back to Mexico to wait out their U.S. court hearings there instead of in the United States, she said.

'They are putting out policies without having an operational plan in place,' said Cardinal Brown. 'It's a throwing-spaghetti- against-the-wall-type approach.'