A federal judge in California on Monday rejected the Trump administration’s request to indefinitely detain immigrant families apprehended at the border, calling it an attempt by the federal government to simply “light a match” to a two-decade-old settlement that set strict standards for detaining immigrant children.

U.S. District Judge Dolly Gee in Los Angeles ruled that the Trump administration had no legitimate grounds on which to alter the 1997 settlement agreement, called the Flores Agreement, which established limits on how long immigrant children can be detained. Detaining immigrant minors indefinitely in unlicensed facilities, Gee wrote, “would constitute a fundamental and material breach” of the agreement.

Gee’s ruling guts a significant portion of President Trump’s June executive order that, after a nationwide outcry, ended mass family separations at the border in exchange for mass family detentions. In the executive order, Trump directed Attorney General Jeff Sessions to seek modification of the Flores Agreement so immigration officials could indefinitely detain families while their cases wind through immigration court.

But a 2016 federal appeals court ruling requires the government to release children from family detention centers within 20 days, in keeping with Flores.

Arguing for indefinite detention, the Justice Department said it had no other feasible alternative since it could no longer separate families and remains opposed to releasing the families on bond, a practice that has been called “catch-and-release.”

But Gee disagreed with this assessment, saying the federal government advanced a “tortured interpretation” of the Flores Agreement in making its argument.

“Absolutely nothing prevents Defendants from reconsidering their current blanket policy of family detention and reinstating prosecutorial discretion,” she wrote.

Gee’s ruling leaves the Trump administration sandwiched between court rulings and leaves the so-called zero-tolerance policy in limbo. The administration is both unable to keep families detained long-term and is also unable to separate families because of a preliminary injunction in San Diego, setting a deadline for reunifications and requiring the 102 youngest children to be reunited with their parents by Tuesday. The government admitted Monday it could not meet that deadline for nearly half of the children.

As Gee suggests, prosecutorial discretion would allow for the release of some families on bond until their next court date, while also relieving detention facilities of immense capacity issues. That’s a policy the Trump administration has loathed and an Obama-era practice Trump promised to end while a candidate for president. Nevertheless, as The Washington Post’s Nick Miroff reported last month, the administration was left with little alternative after separations were halted and there was not enough space to hold all the families in existing facilities. Trump’s executive order had called for the construction of more.

The Justice Department did not say whether it would appeal Gee’s ruling.

“We disagree with the court’s ruling declining to amend the Flores Agreement to recognize the current crisis of families making the dangerous and unlawful journey across our southern border,” spokesman Devin O’Malley said in a statement.

Gee’s ruling rested largely on the same reasoning — at times, even the verbatim scathing language — she used to rebuke the Obama administration for its family detention policy in a ruling in 2015.

The Obama administration’s “no-release” policy followed an unprecedented surge of tens of thousands of Central Americans seeking asylum at the U.S.-Mexico border in 2014. At the time, Department of Homeland Security officials argued detaining all families could act as a “deterrent” against illegal border crossings. They also argued the Flores Agreement “encouraged” illegal immigration, because families might try to use children as a means of gaining release.

The Trump administration not only used these same arguments, but also even quoted the Obama administration directly to support its request for indefinite detention.

“As the Government explained in 2015,” DOJ lawyers wrote, “aliens cross the border illegally relying on promises from traffickers that ‘they will not be detained but instead will be released.’ . . . Such an incentive structure increases the chances that an alien without a valid claim for relief in the United States will be able to remain here illegally during lengthy removal proceedings. As the Government explained in 2015, ‘detaining these individuals dispels such expectations and deters others from unlawfully coming to the United States.’”

To that argument Gee responded: “As it did before, the Court finds Defendants’ logic ‘dubious’ and unconvincing.”

Gee took particular issue with the Trump administration’s claims that her 2015 ruling actually caused a surge in illegal immigration. In its filing, the Justice Department wrote, “Following the July 2015 ruling, there was a 3 to 5-fold increase in the number of illegal family border crossings. This surge is not a mere coincidence, it is the direct result of the message sent to those seeking illegal entry: we will not detain and deport you.”

Gee said the government could not provide any evidence that her ruling — rather than outside factors such as civil unrest or “fear of death” in the migrants’ home countries — are the real source of any increase in illegal border crossings.

As Gee had noted previously, if the federal government is frustrated by the limitations imposed by the Flores Agreement, Congress has full authority to pass laws overhauling the immigration system as it pertains to immigrant minors, rather than repeatedly asking a judge to do away with a long-standing agreement.

“It is apparent that Defendants’ Application is a cynical attempt . . . 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,” she wrote.

“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.”

Content from Allstate This content is paid for by an advertiser and published by WP BrandStudio. The Washington Post newsroom was not involved in the creation of this content. Learn more about WP BrandStudio.