Trump and congressional Republicans thought they could use the threat of deporting the DREAMers as a bargaining chip to make Democrats agree to their demands. But a federal court just ruled they can’t.

Donald Trump met with bipartisan congressional leaders Tuesday, ostensibly to discuss immigration. Although he appeared to lack a firm grasp on the issue, one of the key takeaways of this stunt is that he intended to hold the threat of deporting young, high-skilled, community-tied immigrants known as “DREAMers” over Democrats’ heads to make them capitulate to draconian, nativist changes to the immigration system.

In return for permanently protecting the DREAMers, Trump is demanding the construction of his border wall, elimination of a program that admits people from low-migration countries, and ending “chain migration” — a derogatory term for legal immigrants bringing their families.

But just hours after the talks concluded, a district judge in San Francisco blew up Trump’s strategy, ruling it is illegal for him to deport the DREAMers in the first place.

The main reason the DREAMers are in legal limbo is that Trump terminated the Obama-era Deferred Action for Childhood Arrivals (DACA) program last year. Judge William Alsup ruled this decision was improper, issuing an injunction to “maintain the DACA program on a nationwide basis.”

Ironically, Trump’s own tweets were used as evidence that terminating DACA was illegal. Alsup cited multiple Trump tweets indicating support for the DREAMers, including one calling them “educated and accomplished young people with jobs, some serving in the military,” to demonstrate that Trump “publicly favors the very program [he] has ended.”

It is important to note that this is not the end of legal questions on the DREAMers, nor does it definitively prohibit Trump from ever deporting them. A permanent act of Congress is still needed to protect them, in case a higher court reverses this ruling or Trump finds a way to rewrite his anti-DACA order that passes legal muster.

Indeed, the DREAMers were in legal limbo even before Trump, because, despite the fact that 86 percent of Americans want them to stay, Republicans in Congress spent years blocking a bill to grant them permanent residency. President Barack Obama had intended DACA to be only a temporary reprieve from deportation until such a bill was passed, but that temporary reprieve stretched into years.

That being said, Trump was counting on the imminent threat of deportation to come to the table with the upper hand and walk away with a “security first” deal. Democrats will be less inclined to broker a compromise on his terms, now that they know his legal power to do immediate harm to the DREAMers is limited.

Trump is used to a negotiation table skewed in his favor. That is why, in the business world, he repeatedly refused to pay contractors and forced them to sue him. He thought he would have this same kind of leverage against Democrats by eliminating DACA.

He was wrong.