A federal judge on Friday blocked the Trump administration’s attempts to significantly undo the Flores Settlement Agreement, which mandates certain protections for children held in immigration detention.

The changes to the settlement would have allowed the administration to hold immigrant children and their parents indefinitely in jail-like settings.

Federal Judge Dolly Gee repeated that the 22-year-old settlement is still binding, even after multiple court hearings. In her written decision, the judge said that Flores is a contract into which the federal government had “willingly entered and agreed to be bound.”

In August, the Departments of Homeland Security and Health and Human Services issued a final rule after receiving tens of thousands of public comments opposing the changes. The rule would have greatly impacted the Flores settlement by effectively scrapping a key component of Flores—that children should not be detained for longer than 20 days.

Judge Gee highlighted several inconsistencies between the new regulations and the original Flores agreement.

One inconsistency is the changed licensing requirements for facilities that hold detained children.

Judge Gee pointed out that the new regulations would allow the government to self-license many facilities according to its own standards, ignoring the requirement that an independent party (a state licensing agency) set the standards.

Similarly, in what Judge Gee called “Kafkaesque fashion,” the new regulations sought to change the definition of nonsecure facilities.

According to the administration, nonsecure facilities could include detention centers that are entirely locked and fenced, as long as a reception area remains unlocked. If enacted, the new regulations would allow more children to be held in secure facilities and limit opportunities for children to bond out or be released to responsible adults.

The new regulations also deleted mandatory wording from Flores and replaced it with less-restrictive language. For example, a requirement that in certain circumstances the government “shall release a minor” was replaced with language stating only that a minor “may be released.”

While the language of Flores itself allows the government to issue regulations to replace it, the regulations must be reviewed and approved by the court before going into effect. During that review process, Judge Gee found that the new regulations “defeat the purpose” of Flores.

It is not in the public interest to allow the government to breach its contract. Judge Gee has repeatedly reached this conclusion in her previous rulings on the government’s failures to comply with Flores. On Friday, she added that increased border apprehensions are not a good reason for prolonged detention.

Perhaps the best summary of the opinion came in court itself. When a government attorney claimed the new regulations did in fact fully implement the Flores settlement, Judge Gee responded:

“Just because you tell me it is night outside does not mean it is not day.”

At a time when many of the Trump administration’s immigration policies attempt to plunge children into darkness, rulings like this one affirm that legally, it’s still day.