The US Supreme Court ruled on Tuesday that an immigration statute requiring the deportation of non-citizens who commit felonies is unlawfully vague in a decision that could limit the Trump administration’s ability to step up the removal of immigrants with criminal records.

The court, in a 5-4 ruling in which President Donald Trump’s conservative appointee Neil Gorsuch joined the court’s four liberal justices, sided with convicted California burglar James Garcia Dimaya, a legal immigrant from the Philippines.

The court upheld a 2015 lower court ruling that the Immigration and Nationality Act provision requiring Dimaya’s deportation created uncertainty over which crimes may be considered violent, risking arbitrary enforcement in violation of the US Constitution.

The ruling helps clarify the criminal acts for which legal immigrants may be expelled at a time of intense focus on immigration issues in the United States as Trump seeks to increase deportations of immigrants who have committed crimes.

Liberal Justice Elena Kagan wrote the court’s ruling, delivering a setback to the Trump administration, which had defended the law at issue.

“Vague laws invite arbitrary power,” Gorsuch wrote in a concurring opinion, adding that the American colonies in the 18th century cited vague English law like the crime of treason as among the reasons for the American revolution.

“Today’s vague laws may not be as invidious, but they can invite the exercise of arbitrary power all the same - by leaving the people in the dark about what the law demands and allowing prosecutors and courts to make it up,” Gorsuch added.

Dimaya came to the United States from the Philippines as a legal permanent resident in 1992 at age 13. He lived in the San Francisco Bay area.

Federal authorities ordered Dimaya deported after he was convicted in two California home burglaries, in 2007 and 2009, though neither crime involved violence. He received a two-year prison sentence for each conviction.

In 2010, the government sought to deport Dimaya. The Justice Department’s Board of Immigration Appeals, an administrative body that applies immigration laws, refused to cancel his expulsion because the relevant law defined burglary as a “crime of violence.”

In the federal criminal code, a “crime of violence” includes offenses in which force either was used or carried a “substantial risk” that it would be used.

The San Francisco-based 9th US Circuit Court of Appeals ruled in 2015 that the definition as applied to legal immigrants was so vague that it violated their rights to due process of law under the US Constitution. The language of the law could lead arbitrary or discriminatory enforcement, that court said.

The appeals court relied on a decision that same year by the US Supreme Court , which found that a similar provision in a federal criminal sentencing law was overly broad.

The federal government appealed to the Supreme Court , arguing that the US Congress had reasonably identified a category of crimes that carry the risk of violence, and suggested that the justices should defer to the immigration authorities.

The Supreme Court heard arguments in the case on Oct. 2, the first day of its current nine-month term. It initially heard arguments in January 2017 when the nine-seat court was one justice short, but decided in June after Gorsuch brought the court to full strength to have the case re-argued.