The Supreme Court delivered a win for immigrants battling the Trump administration, with the justice Trump put on the high court, Neil Gorsuch, providing the margin of victory.

The case, Sessions v. Dimaya, will immediately impact thousands of immigrants who are here legally but have committed crimes that trigger deportation. It also illustrates how judicial “originalism” like Gorsuch’s can lead to functionally liberal results.

Under the Immigration and Naturalization Act (INA), any non-citizen who commits a “crime of violence” forfeits their right to remain in the country, regardless of their immigration status, how long they’ve lived here, and whether they have family here as well. Indeed, the INA makes their deportation mandatory. Such immigrants were often considered low-priority by the Bush and Obama administrations. Yes, they were technically supposed to be deported, but if they were here legally and didn’t have a serious criminal record, they’d be de-prioritized by the INS (now ICE).

Since January, 2017, however, thousands have been caught up in ICE’s dragnet, with millions more at risk. The examples have been heart-rending. Thousands of Vietnamese refugees who came here in 1975 after helping America in the Vietnam War, are now set to be deported for relatively minor criminal infractions. An HIV-positive asylee is being deported to Venezuela, where HIV medication is unavailable, because of a minor drug infraction—effectively a death sentence. A father and grandfather who has lived in the United States for 40 years is arrested because of a 1996 marijuana offense, and is now rotting in detention. These are all people who came here legally, but whose criminal acts have triggered mandatory deportation.

Today, that ends.

In a 5-4 decision, with Justice Gorsuch joining the Court’s liberals, the Supreme Court held that this part of the INA is unconstitutionally vague. Because it never defined what a “crime of violence” is, courts had to figure out how to do so themselves. And, the Court said today, the way they did so – grouping crimes into categories and determining which categories were typically violent – is so vague that it violates the Due Process Clause of the Fifth Amendment.

Nor can courts decide on a case-by-case basis, the Court noted, because that, too, deprives defendants of due process. Part of due process means having an orderly system of justice, with penalties clear in advance.

The decision is yet another in a long line of defeats (with some exceptions) for the Trump administration’s crackdown on immigration. Courts have sharply limited the government’s anti-Muslim travel ban, refused to rubber-stamp its rollback of DACA, and rejected Trump’s attempt to target sanctuary cities.

Does this mean that Gorsuch has gone soft, and is now a bleeding-heart liberal moved by the plight of immigrants?

Not at all. On the contrary, in a concurring opinion, he reaffirmed his philosophy of “originalism” with a strong dose of libertarianism as well. “Vague laws invite arbitrary power,” the opinion begins. It proceeds to give a Scalia-like history lesson about the background to the Declaration of Independence and the Constitution.

“ Vague laws invite arbitrary power. ” — Justice Neil Gorsuch

Indeed, the whole case is, in a sense, a testament to Justice Antonin Scalia’s legacy. The Court’s opinion, written by Justice Elena Kagan, relies heavily on Scalia’s opinion in a 2015 case that invalidated part of the federal “Three Strikes and You’re Out” law for identical reasons: part of the law was so vague that it violated the Due Process Clause.

Contesting that legacy today was Justice Clarence Thomas, who wrote that the vagueness doctrine is, itself, a judicial invention not found in the text of the Constitution. In a sense, Gorsuch and Thomas are debating who’s the real originalist, who’s the heir to the late Scalia. On one side, Thomas is clearly correct that the word “vagueness” is not in the Constitution. On the other, Gorsuch devotes eight pages to musty, old sources showing that the Founders considered specificity and fair notice to be intrinsic to the meaning of due process.

Ultimately, Gorsuch found enough common cause with the civil-libertarian wing of the Court to join in the result. Kagan’s opinion is clearly written more narrowly than it might otherwise have been, relying entirely on Johnson and refraining from comments about the fundamental injustice of the INA’s deportation scheme. There’s no bleeding-heart rhetoric to be found.

Conversely, none of the liberals joined in Gorsuch’s history lecture. For them, the unfairness of the vague deportation trigger is manifestly in violation of due process, regardless of what Blackstone wrote in 1769.

And, to be sure, the conservative justices have ample citations of their own, which is one reason “originalism” is not taken seriously by the vast majority of legal scholars. Give me a position, and I’ll find an “original” source that supports it.

But originalism is taken very seriously by conservatives. If applied by the Supreme Court – as it will be if Trump gets one more justice on it – it would wipe out the right to privacy, which undergirds the rights to abortion and contraception, since “privacy” isn’t found in the constitution and doesn’t have the same history as “vagueness” does (at least according to Gorsuch).

It would also sharply limit equal protection law, endangering recent curbs on racial, gender, and sexual orientation discrimination. And it would likely limit all kinds of federal regulations based on the commerce clause. Originalism is the judicial key to rolling back the administrative state.

Today, however, originalism led to a liberal result. The government has been deporting people based on crimes that are vaguely defined. And that, liberals and Justice Gorsuch agree, violates the Fifth Amendment. Today, the unlikely hero for legal immigrants caught in ICE’s web is Justice Neil Gorsuch.