The solution to the crisis of family separation at the US-Mexico border, the Trump administration has decided, is to get rid of a 1997 federal court decision that strictly limits the government’s ability to keep children in immigration detention.

The administration has fingered Flores v. Reno, or the “Flores settlement,” as the reason it is “forced” to separate parents from their children to prosecute them. It claims that because it cannot keep parents and children in immigration detention together, it has no choice but to detain parents in immigration detention (after they’ve been criminally prosecuted for illegal entry) and send the children to the Department of Health and Human Services as “unaccompanied alien children.”

The Flores settlement requires the federal government to do two things: to place children with a close relative or family friend “without unnecessary delay,” rather than keeping them in custody; and to keep immigrant children who are in custody in the “least restrictive conditions” possible.

Republicans in Congress have proposed legislation that would overrule Flores and allow children to be kept with their parents in Immigration and Customs Enforcement (ICE) custody while they are put through criminal prosecution and deportation proceedings — which many migrant families fight by claiming asylum in the US, a process that can stretch out for months or years.

Trump can’t overrule the Flores settlement with the stroke of a pen. But getting rid of the court agreement has been in his administration’s sights for months. While Republicans frame Flores as the obstacle to keeping families together, many of the people outraged over family separation might not be too happy with a world without Flores, either.

The Flores settlement dates back to mistreatment of unaccompanied minors in the 1980s

The Flores settlement now at the center of the family separation crisis has a 30-year history. In the 1980s, several lawsuits were filed over the treatment of unaccompanied minors who were in the care of the US government. One was filed by the American Civil Liberties Union in 1985 on behalf of Jenny Lisette Flores, a 15-year-old from El Salvador. She had fled her home country to find an aunt who was living in the United States, but she was detained by federal authorities at the US border.

Flores and other minors in federal custody sometimes had to share sleeping quarters and bathrooms with unrelated adult men and women. Flores was strip-searched regularly, and she was told she could only be released to her parents, not her aunt. The ACLU asserted in its lawsuit that Flores and other unaccompanied children had a constitutional right to be released to “responsible” adults, as the Marquette Law Review documented in a review of the Flores settlement’s history.

The case went through several federal courts before reaching the Supreme Court in 1993, and the high court mostly sided with the government. But the real consequence was a consent decree agreed to by the Clinton administration and the plaintiffs in the litigation in 1997. The decree, known as the Flores settlement, set standards for unaccompanied minors who were in the custody of federal authorities.

The agreement required that children be released as soon as possible to either their parents, a legal guardian, another relative, or a vetted entity willing to take legal custody of the child. According to a summary from the Congressional Research Service, the order also required those minors who would be kept in federal custody be placed in the least restrictive conditions possible and be provided with some basic necessities, like food and water, access to medical treatment, access to running water, and that they be separated from adults to whom they had no relation.

But over the years, immigration authorities were not fully complying with the Flores settlement. Congress passed laws in the 2000s that would eventually require the Department of Homeland Security put unaccompanied children in the care of the Office of Refugee Resettlement, within the Health and Human Services Department.

Under current Flores rules, children “accompanied” by parents have to be released within 20 days

Over the past couple of decades, the principles undergirding Flores evolved into specific rules about exactly how long and under what conditions children can be held. But they generally applied only to children who had entered the US as unaccompanied minors — not those who arrived with their parents.

In 2014, however, the Obama administration attempted to tamp down the number of Central American families seeking asylum in the US by keeping families in detention and processing and deporting them as quickly as possible.

Immigration advocates challenged the policy of family detention under Flores. And judges agreed with them — in large part because it said the Obama administration was out of bounds in detaining migrant families for the purpose of “deterrence.” (As NBC’s Benjy Sarlin has pointed out, that’s why certain Trump administration officials have been careful not to say that family separation is a deterrent, or even a policy, now.)

Ultimately, the Ninth Circuit ruled that the Flores settlement covered not just unaccompanied alien children but “accompanied” ones as well. It set a general standard that the government couldn’t hold them in custody for more than 20 days.

The Ninth Circuit stopped short of saying that parents could be released under Flores. But the federal government hasn’t responded to Flores by keeping families together for a few weeks and then splitting them apart.

Instead, it’s made a practice, for the most part, of releasing the whole family after 20 days. Since the current family detention facilities — two in Texas created under Obama, and an older one on Pennsylvania — are mostly full, they don’t have a ton of space to detain families anyway.

This is one example of what the Trump administration calls “catch and release.”

The Trump administration has always seen ending Flores as a “solution”

To the administration, the extra legal protections against indefinite detention of asylum seekers, and much stricter protections under the Flores settlement against indefinite detention of children and families, are nothing but legal “loopholes.” It would prefer to be able to detain all immigrants who enter the US without papers until their cases are resolved (and, preferably, resolve those cases as quickly as possible with deportation orders).

Keeping families together in immigration detention really would suit the government’s interests. It’s more expensive to keep parents in detention while children are under HHS care (or placed with sponsors or fosters) than to keep both in one detention facility. And legally, the government would be allowed to treat the family as only one case, with one shot to enter the US, rather than as two separate cases as parent and child.

Attorney General Jeff Sessions’s efforts to change asylum policy are intended to keep many immigrants fleeing gang violence from passing their initial asylum screenings — thus allowing the government to deport the whole family together quickly rather than allowing the child to enter the US to pursue a full court case. (However, the implementation of Sessions’s changes, at least for the moment, doesn’t appear to be as radical as was initially feared.)

The question is how to do it.

In theory, Flores could be superseded at any time by DHS regulations — it wasn’t supposed to be a de facto law, just a framework to keep in place while the government came up with permanent rules to ensure migrant kids were adequately protected. (Of course, what counted as “adequately” would be up to the court.) Or Congress could pass a bill that made it clear that children are allowed to be kept in Immigration and Customs Enforcement facilities just like adults are, wiping away the Flores settlement.

At first, Trump’s DHS was reportedly considering trying to go the regulatory route.

According to the Washington Post (in an April article), the proposed regulations would codify the government’s ability to separate families, but would also open the door to longer stays for families detained together:

The proposal also attempts to address a restriction on how long migrant children and their parents can be held at the family residential facilities. Judges have ruled that their stays must be limited to 20 days or less, in part because the centers are not state-licensed. The proposed regulations would allow federal licensing of such facilities, which could open the door for longer stays. The draft says the administration currently holds families for an average of 14 days and is examining cost estimates that would expand that to an average of 45 days.

But issuing regulations is a months-long process, and President Trump doesn’t have time for these things. Instead, he plunged ahead with the “zero tolerance” prosecution policy, making the separation of families a widespread occurrence — and prompting a groundswell of opposition that appears to be getting stronger by the day.

Getting rid of Flores means indefinite family detention

It’s not at all clear that Trump can, legally, issue an executive order that would override the Flores settlement. That’s why analysts are assuming that any order Trump issues to keep families together in DHS custody will be challenged by a lawsuit and may get thwarted.

If DHS somehow manages to craft an executive order that evades that issue, or if Congress passes any of the suite of Republican bills that purport to end family separation by expanding family detention, it will mean one of two things.

Either the Trump administration will start keeping families in detention for as long as it takes to fully adjudicate their asylum cases — which can take months or years — or it will need to ram them through an “expedited” legal process to minimize their time in detention.

President Obama tried the latter in 2014. It went horrifically. Pro bono lawyers who went to family detention facilities (which were flung together in a matter of weeks) reported that it was all but impossible for families to get due process for their asylum claims.

The former is what families are still going through at the Pennsylvania facility. The long-term detention of immigrant children raises some of the same concerns that keeping them in custody without their parents does, in terms of long-term trauma. Bright lights in the Burks facility reportedly keep children from sleeping well, for example — and they can be disciplined if they try to climb into a parent’s bed for comfort.

Furthermore, getting rid of the Flores settlement entirely wouldn’t just get rid of the mandate to release children; it would also get rid of the requirements for what conditions children must be held in. In other words, the legal standards that undergird the Office of Refugee Resettlement facilities — standards that Trump administration officials brag are among the highest in the world — would be wiped away.

Depending on what replaced Flores, it’s possible that ICE could simply use existing adult detention facilities to herd children into as well.

The Trump administration could hold itself to higher standards. But for that matter, it could also find an alternative to detaining immigrant families that still allowed the government to ensure they showed up in court. It does not appear inclined to do so.