A federal judge Friday rejected a sweeping Trump administration effort to detain migrant families and children for longer periods of time than currently allowed, saying it violates the very court settlement the government sought to scrap with its plan.

The Flores Agreement sets sweeping standards for the treatment of unaccompanied migrant children, from housing to medical care as well as education, nutrition and hygiene. In more recent rulings, Judge Dolly Gee has also effectively prohibited the government from detaining for more than 20 days families apprehended with children.

Attorneys outside the courthouse in Los Angeles hailed Gee’s decision to preserve the landmark 1997 settlement. They said Gee appeared unimpressed with the government’s efforts in the case.

“She did not hide her complete disregard for (the government’s) failed attempts to withdraw from this settlement,” said Neha Desai, the director of Immigration for the National Center for Youth Law.

The preliminary decision was provided just to attorneys working the case Friday, but a final ruling is expected to be issued in the near future, according to Desai and other attorneys involved in the case.

The Flores Agreement has faced waves of criticism from federal officials coping with cyclical surges of unaccompanied migrant children, leading to unsuccessful attempts by both the current White House and the administration of former President Obama to alter it. Ultimately, on August 21, the Trump administration unveiled a Final Regulation on the care of migrant children and families that it believed would render the Flores Agreement obsolete.

In briefs filed for Judge Gee, the government claimed that immigration has changed in the 22 years since the Flores Agreement was first established, and argued that the agreement itself led to an increase in children and families coming to the U.S.

In response, lawyers opposing the government action wrote that the government was attempting to “light a match” to the Flores Agreement with a “dizzying array” of claims about migrant children and families that federal courts had already rejected.

In the brief, filed in the U.S. District Court for the Central District of California, attorneys cited experts who said in attached declarations that complex, local socioeconomic factors cause families with kids — or children traveling without families — to uproot their lives. Those factors include gang violence, extreme poverty and local government corruption.

Desai said she expects the government to appeal the ruling.

“We know the fight’s not over, and we’re here to defend the Flores Agreement to wherever it goes, and whatever it takes,” Desai said.