Last fall when President Donald Trump formally announced an end to the Deferred Action for Childhood Arrivals program or DACA, he said he regretted hurting 800,000 or so children and expressed hope that they might be spared deportation. Nearly eight months later, such an opportunity has arisen. Tuesday’s decision by a federal judge in Washington, D.C., not only reaffirmed past rulings that “dreamers” — as those who are enrolled in DACA are commonly described — must continue to be protected, but he went one step further: Soon, the U.S. Department of Homeland Security will have to take new applicants for DACA protections as well.

That decision by U.S. District Judge John D. Bates, a George W. Bush appointee, incidentally, turned on a simple principle — the Trump administration failed to give an adequate justification for its “arbitrary and capricious” actions on DACA. Indeed, the Trump administration never gave much explanation at all as to why young undocumented immigrants who came to the U.S. before they turned 16 represented any kind of security threat. To qualify, they had to have arrived by 2007, be vetted for criminal history, attend or graduate from school or perform military service, and reapply every two years. In return, they were given temporary right to remain in the U.S. and hold down a job.

For many such individuals, the United States is the only country they’ve ever known. Where would they be deported? To a country where they might not even speak the language? And given congressional gridlock over immigration reform, the 2012 executive action by President Barack Obama was a reasonable compromise. Certainly, that’s how most Americans see it. Polls have consistently shown widespread support for dreamers, including a CBS News survey that pegged the number of Americans who favor keeping DACA recipients in the U.S. at 87 percent. More people believe Bigfoot is a real creature than favor deportation.

What President Trump said last fall was that DACA was likely to be overturned in federal court because a handful of states had threatened lawsuits. But favorable rulings so far show just how mistaken that justification was — if it represented any justification at all. If anything, the decision to end DACA seemed entirely guided by politics, including a desire to reverse President Obama’s legacy, to toss a red meat anti-immigrant win at the Trump political base and, perhaps most importantly, to pressure congressional Democrats to agree to restrictions on immigration including the construction of a border wall that the president had promised.

Even President Trump seemed to have doubts about the wisdom of his approach to DACA at times. Earlier this year, he proposed a path toward citizenship for far more Dreamers than even DACA protects, calling for a “bill of love” from Congress. But when Mr. Trump loaded up a prospective deal — restoring DACA protections in return for billions in border security money — with all kinds of restrictions on legal immigration and family reunification, the Democrats walked away. After much tweeting and fuming, the $1.3 trillion spending bill was eventually signed into law anyway without addressing DACA or immigration at all.

So here’s a way for the Dreamers to be protected, President Trump to be responsive to public opinion and for the Department of Justice to devote its resources to better causes (like keeping AR-15s out of the hands of crazy people) — end the appeals and allow the court rulings to stand. Mr. Trump has certainly reversed himself on policy before without batting an eye (describing North Korea’s Kim Jong-Un as “very honorable” instead of “little Rocket Man” being the most recent and perhaps most jaw-dropping example). The president’s base won’t revolt over DACA — compared to Mr. Trump’s newfound love for a Korean dictator and deficit spending, it’s small potatoes.

Meanwhile, the Supreme Court may yet hand President Trump an immigration victory, albeit an ignoble one if a majority rules in favor of his ban on travel to the U.S. from several countries, most of which are predominantly Muslim. Given the signal of support given Wednesday during oral arguments by Chief Justice John Roberts and Justice Anthony Kennedy, that now seems likely despite Mr. Trump’s frequent (not to mention misguided, illegal and counter-productive) promises during the campaign to broadly restrict Muslim entry into the country. Thus, President Trump will ultimately be able to crow about his triumph of religious discrimination without having to throw DACA kids under the bus as well.