WASHINGTON — The Supreme Court on Tuesday struck down a law that allowed the government to deport some immigrants who commit serious crimes, saying it was unconstitutionally vague. The decision will limit the Trump administration’s efforts to deport people convicted of some kinds of crimes.

The vote was 5 to 4, with Justice Neil M. Gorsuch joining the court’s four more liberal members to form a bare majority, which was a first. Justice Gorsuch wrote that the law crossed a constitutional line.

“Vague laws,” he wrote in a concurring opinion, “invite arbitrary power.”

Justice Gorsuch had voted with the court’s conservative majority in February in a different immigration case, one that ruled that people held in immigration detention, sometimes for years, are not entitled to periodic hearings to decide whether they may be released on bail.

His vote in Tuesday’s case was not entirely surprising, though, as he has a skepticism of vague laws that do not give people affected by them adequate notice of what they prohibit.