Justice Neil Gorsuch provided the decisive vote Tuesday in a Supreme Court ruling striking down a key provision that made it easier to deport immigrants convicted of violent crimes, in a blow to the Trump administration.

President Trump's Supreme Court pick has largely sided with the conservative members of the bench since his appointment, but sided with the liberal wing on Tuesday.

"Today’s Court decision means that Congress must close loopholes that block the removal of dangerous criminal aliens, including aggravated felons. This is a public safety crisis that can only be fixed by Congress – House and Senate must quickly pass a legislative fix to ensure violent criminal aliens can be removed from our society. Keep America Safe!" Trump tweeted in response Tuesday evening.

The court said the part of the law in question was too vague to be enforced.

The court's 5-4 decision concerned a provision of federal 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 Trump's administration which, like President Barack Obama's administration before it, had defended the provision at issue before the Supreme Court. And it comes amid an ongoing focus on immigration by Trump.

The case the high 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 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 didn't decide the issue, presumably because the justices were deadlocked 4-4. After Gorsuch joined the court, the justices heard the case re-argued. Gorsuch joined the court's more liberal justices in finding the clause too vague.

The case is Sessions v. Dimaya, 15-1498.

The Associated Press contributed to this report.