Tuesday's Supreme Court ruling on an immigration law may not have gone the way President Donald Trump had hoped—and he has his own handpicked appointee to blame.

Justice Neil Gorsuch sided with his left-leaning colleagues to deliver a 5-4 opinion on federal legislation that would have left immigrants convicted of crimes considered "violent" subject to deportation. The Supreme Court had weighed in on the immigration law during the 2016 term—after the death of Justice Antonin Scalia—but hadn't been able to break its 4-4 tie to deliver a decisive ruling.

Gorsuch effectively broke the deadlock.

When the law was being argued in court in October, Gorsuch worried that people were being incarcerated and deported for "violent" crimes despite the fact that Congress couldn't seem to even agree on what made a crime violent. Under the federal criminal code, a “crime of violence” refers to direct force or the “substantial risk” that it would be used.

Gorsuch maintained that the law deprived people of "life, liberty of property" and violated the vagueness doctrine, which requires laws to be clear and explicit, lest they be enforced arbitrarily. "Shouldn't [we] expect Congress to be able to specify those who are captured by its laws?" Gorsuch asked at the time.

The 5-4 majority opinion reflected Gorsuch's concerns, stating that the law is unconstitutionally vague in a victory for the case's lead plaintiff, James Garcia Dimaya—a Filipino man who faced removal under the Obama administration for two burglary convictions—as well as immigrant rights activists more broadly.

Supreme Court Justice Neil Gorsuch (right) was President Donald Trump’s first appointee to the bench—but he may not rule the way Trump wants. Eric Thayer/Getty Images

The justice's vote is likely a disappointing one for Trump, who made it clear from the day he descended an escalator to announce his candidacy, that he would paint immigrants as criminals ripe for deportation.

“When Mexico sends its people, they’re not sending their best," Trump said when he announced his presidential bid. "They’re sending people that have lots of problems, and they’re bringing those problems with us. They’re bringing drugs. They’re bringing crime. They’re rapists. And some, I assume, are good people."

Since being elected, Trump has promised to deport between 2 and 3 million undocumented immigrants, allegedly focusing on those with criminal records.

But Gorsuch has emphasized before the need for "judicial independence," free from the president's influence or anyone else's.

"If judges were just secret legislators, declaring not what the law is but what they would like it to be, the very idea of a government by the people and for the people would be at risk," Gorsuch said in March 2017, when he was still just a nominee.

The president may have more disappointments ahead. Trump has said he intends to appoint pro-life justices who would overturn Roe v. Wade. Gorsuch has hinted at an anti-choice stance before—with votes against Planned Parenthood and in favor of Hobby Lobby, the Christian-owned company that won the right to deny employees birth control coverage—but it's still no guarantee that the justice would vote to overturn the landmark abortion rights decision, if given the chance.

"I would have walked out the door," Gorsuch said during his confirmation hearing, when asked if Trump had asked him to reverse Roe v. Wade. "That's not what judges do."