A federal judge on Monday rejected the Trump administration's bid to change the terms of a 1997 settlement agreement that restricts how long children can be held in immigration detention, undercutting a major part of Trump's executive order addressing the border separations crisis.US District Judge Dolly Gee wrote that the Justice Department's motion to modify the settlement, known as the Flores agreement, was a "thinly veiled" effort to raise challenges to the settlement that the judge had already considered and denied."It is apparent that Defendants’ Application is a cynical attempt, on an ex parte basis, to shift responsibility to the Judiciary for over 20 years of Congressional inaction and ill-considered Executive action that have led to the current stalemate," Gee wrote.She continued: "Regardless, what is certain is that the children who are the beneficiaries of the Flores Agreement’s protections and who are now in Defendants’ custody are blameless. They are subject to the decisions made by adults over whom they have no control. In implementing the Agreement, their best interests should be paramount."The government has interpreted the settlement and subsequent rulings in the case to mean that children cannot be held in immigration detention for more than 20 days. Complying with the settlement as is will make it difficult for the administration to reunite separated families while also maintaining a "zero tolerance" approach to immigrants apprehended at the border.Justice Department spokesperson Devin O'Malley said in a statement that DOJ was reviewing the ruling."The Trump Administration continues to make good-faith efforts that allow us to not only enforce the law, address the crisis of illegal immigration our border, and protect our nation and its citizens, but also protect the safety of children in government care and custody," he said.Attorney General Jeff Sessions earlier this year adopted the "zero tolerance" policy, directing US attorney offices at the border to prosecute all illegal entry and attempted illegal entry cases referred by the Department of Homeland Security. When parents who arrived with children were taken into criminal custody, they were separated from their children. The children were then classified as unaccompanied minors and placed under the care of the Office of Refugee Resettlement, the agency within the Department of Health and Human Services responsible for managing children in immigration detention.Facing intense criticism as the number of separated families grew, Trump on June 20 signed an executive order that he said would address border separations. The order directed DHS to keep detained families together, but the long-term effectiveness of that order depended on the judge agreeing to modify the Flores agreement, or on Congress taking action. Congress has yet to agree on legislation on the issue, and, as of Monday, the administration had lost in court.The Flores agreement requires the government to place immigrant children taken into custody at the border in a nonsecure, licensed facility, ruling out long-term detention. The Justice Department under the Obama administration had previously, and unsuccessfully, tried to convince Gee that the agreement shouldn't apply to children who arrive in the United States with a parent. Gee wrote in Monday's order that the government had failed to show that the number of family crossings had gone up because of her 2015 order, or that current circumstances merited a change in the terms.The administration now sought "to light a match to the Flores Agreement and askthis Court to upend the parties’ agreement by judicial fiat," Gee wrote.Holding children indefinitely in unlicensed facilities "would constitute a fundamental and material breach" of the agreement, the judge concluded.The administration, meanwhile, is contending with an injunction issued last month by a federal judge in San Diego that blocks the government from separating families at the border absent a showing that a parent is unfit or poses a danger to the child, and sets deadlines for reunifying families who were already separated, unless a parent waived that.The injunction placed the Trump administration in a bind — if it wanted to hold migrants with pending immigration cases, it would have to detain children with their parents in order to comply with the San Diego order. But doing that for a long period of time would appear to run afoul of the Flores agreement, although the Justice Department recently filed papers arguing it could hold families without violating the Flores agreement.Gee held that the order out of San Diego did not absolve the administration from also fully complying with the terms of the Flores agreement. She wrote that the government had known for years that its detention facilities did not meet the licensing requirements, but hadn't made an effort to find a solution."Absolutely nothing prevents Defendants from reconsidering their current blanket policy of family detention and reinstating prosecutorial discretion," the judge wrote. Got a confidential tip? Submit it here.