Last September, President Donald Trump ordered an end to Deferred Action for Childhood Arrivals, the Obama-era program that gave legal status to almost 700,000 immigrants who were illegally brought into the United States as children, and gave Congress until this March to find a permanent fix for “Dreamers.” In announcing the decision, Attorney General Jeff Sessions described DACA as “an unconstitutional exercise of authority by the executive branch.” But a federal judge in California disagreed on Tuesday, a ruling that may complicate the fraught congressional negotiations over the fate of so-called Dreamers.

Because Trump’s decision “was based on the flawed legal premise that [the Department of Homeland Security] lacked authority to implement DACA,” District Court Judge William Alsup concluded, the president’s order should be “set aside” while a legal challenge brought by Dreamers and a coalition of Democratic-led states makes its way through the courts. In other words, Alsup ruled that the Obama administration acted lawfully when it created DACA, and therefore the Trump administration can’t end the program by claiming the program wasn’t lawful in the first place.

It’s unclear whether that reasoning will survive scrutiny on appeal. Alsup’s handling of the case already prompted the Supreme Court to intervene in December, when the justices voted 5-4 to vacate his order for the government to turn over additional internal records during the discovery process, which gives the parties to a lawsuit access to documents and other materials from the opposing side that may be relevant as evidence. The justices rarely intervene in this phase of a case, even in high-profile matters.

Until the appellate courts weigh in, the ruling’s immediate effect is to allow Dreamers who were already enrolled in the program prior to Trump’s order to apply to renew their legal status. But that respite could also reduce pressure on congressional leaders to find a permanent legislative fix that would protect Dreamers from deportation. While the president’s DACA order wasn’t set to take effect until March, Democrats have indicated they’ll vote against the a government spending bill—and thereby shut down the federal government—if the program isn’t enshrined into law. Lawmakers have under January 19 to reach an agreement before funding runs out.

Tuesday’s ruling came only hours after Democratic and Republican leaders met with Trump at the White House to discuss immigration. True to form, the president took confusing and contradictory stances. At one point, California Senator Dianne Feinstein suggested that Congress could pass a “clean” bill that only addressed the DACA program. Such a move would effectively give Democrats what they want while pushing Republican priorities to a later date. “I have no problem,” Trump replied, to the room’s astonishment. “I would like to do that.” House Majority Leader Kevin McCarthy then interjected to remind the president of his own party’s policy goals—to pair a DACA fix with Republican goals, which include funding a border wall and ending the diversity visa lottery.

A few hours later, Alsup handed down his decision. The Justice Department said in a statement later that night that the administration’s view of DACA’s legality hadn’t changed and that the department “looks forward to vindicating its position in further litigation.” In a post on Twitter on Wednesday morning, Trump also described his record of defeats in the federal courts as a sign that the American judicial system is “broken and unfair.”

There is some irony to Trump’s reaction. The president’s tweets have caused trouble for Justice Department lawyers in the courts, and Tuesday’s ruling was no different: Alsup cited a December 29 tweet in which Trump warned congressional Democrats “that there can be no DACA without the desperately needed WALL” as evidence that a broader discovery process may be warranted for the plaintiffs. “One such possibility suggested by plaintiffs is that the rescission was contrived to give the administration a bargaining chip to demand funding for a border wall in exchange for reviving DACA,” the judge noted, adding that the president’s tweet “gives credence to this claim.”