The truth is more complex, but still appalling. The sheer effrontery of the government’s argument may be explained, but not excused, by its long backstory.

The government’s “safe and sanitary” argument did not arise from a new case generated by Trump-administration policies. It arose in 1985, during the Reagan administration, when a 15-year-old Salvadoran child named Jenny Lisette Flores was detained after entering the United States illegally, hoping to escape her country’s vicious civil war. Flores spent two months at a facility in California, confined with adult strangers in poor conditions and strip-searched regularly. In July 1985, she and three other minors brought a class action against what was then called the Immigration and Naturalization Service, challenging its policies for the care and confinement of minors.

In 1997, after a dozen years of litigation, the parties settled the lawsuit in what became known as the “Flores Agreement.” The Flores Agreement requires, among other things, that the government hold minors in facilities that are “safe and sanitary” and that they be released from confinement without delay whenever possible.

Over the years, lawyers acting on behalf of minors protected by the Flores Agreement have filed numerous motions asking judges to enforce it, claiming that the government has fallen short of its obligations. They filed the motion now at issue in 2016, during the Obama administration, arguing that ICE (Immigration and Customs Enforcement) and CBP (Customs and Border Protection) were violating the Flores Agreement by, among other things, confining minors in facilities that are not “safe and sanitary.”

United States District Judge Dolly Gee, who considered hundreds of declarations from minors and their parents, ultimately ruled that CBP was violating the Flores Agreement. In 2017, during the Trump administration, she found that CBP failed to provide adequate food and water to minors, that it did not maintain the facilities at adequate temperatures, and that it deprived the minors of sleep by confining them on concrete floors under bright lights. Gee also found that CBP’s obligation to provide “safe and sanitary” conditions included providing soap, dry towels, showers, toothbrushes, and dry clothes. Gee ultimately ordered CBP to appoint a monitor to bring its facilities into compliance with the Flores Agreement.

Read: Are children being kept in “cages” at the border?

Gee’s order put the government in a technical legal bind. When a federal judge appoints an official to monitor compliance with an already existing injunction or agreement like the Flores Agreement, the government cannot immediately appeal. Such a measure is considered an “interlocutory” order—an intermediate one that does not generate a final decision suitable for appellate review. The government can only appeal if the judge modifies the prior injunction or order.