The supreme court announced on Tuesday that part of a federal law that makes it easier to deport immigrants who have been convicted of crimes is too vague to be enforced.

And in a blow to Donald Trump, the judge the president picked to join the court, Neil Gorsuch, who is known as an arch conservative, sided with the more liberal wing of the court in his decisive vote.

The court’s 5-4 decision concerns a provision of immigration law that defines a “crime of violence”. Conviction for a crime of violence subjects an immigrant to deportation and usually speeds up the process.

A federal appeals court in San Francisco previously struck down the provision as too vague, and on Monday the supreme court agreed. The appeals court based its ruling on a 2015 supreme court decision that struck down a similarly worded part of another federal law that imposes longer prison sentences on repeat criminals.

Justice Elena Kagan wrote that the 2015 decision “tells us how to resolve this case”.

The decision is a loss for the Trump administration which, like Barack Obama’s administration before it, had defended the provision at issue.

The case the court ruled in involves James Dimaya, a native of the Philippines who came to the United States legally as a 13-year-old in 1992. After he pleaded no contest to two charges of burglary in California, the government began deportation proceedings against him. The government argued among other things that he could be removed from the country because his convictions qualified as crimes of violence that allowed his removal under immigration law.

The case, Sessions v Dimaya, was initially argued in January of 2017 by a court that was short a member because the late Justice Antonin Scalia’s seat had not yet been filled. An eight member court did not decide the issue, presumably because the justices were deadlocked 4-4.

After Justice Gorsuch joined the court, the justices heard the case re-argued. And this week Gorsuch joined the court’s more liberal justices to deliver a majority in finding the clause too vague.