Immigrants detained for removal proceedings may be held indefinitely and are not entitled to a bail hearing, the Supreme Court ruled Tuesday.

The ruling means that immigrant detainees, who are sometimes held for months and years on end, have no recourse to challenge their confinement.

Justice Samuel Alito delivered the opinion for the court, joined by Chief Justice John Roberts and Justice Anthony Kennedy.

Justices Clarence Thomas and Neil Gorsuch joined most of Alito’s opinion, though they also wrote to say they do not believe the court had jurisdiction to hear the case.

In a rare move, Justice Stephen Breyer read part of his dissent in the courtroom during Tuesday’s proceedings. The justices only read their dissents from the bench when they mean to emphasize their disagreement with the majority.

TRENDING: Watch: GOP Candidate Klacik Gets Kicked Off of 'The View' for Calling Out Behar's Blackface Scandal

Justices Ruth Bader Ginsburg and Sonia Sotomayor joined his opinion. Justice Elena Kagan was recused because she briefly participated in the case while serving in former President Barack Obama’s administration.

The 9th U.S. Circuit Court of Appeals found that individuals held in immigration jails pending deportation may have a hearing every six months to review the legitimacy of their detention. The 9th Circuit based its decision on a legal rule called the canon of constitutional avoidance.

The rule says that where a federal law has multiple interpretations, courts must rely on the interpretation that avoids constitutional problems.

Alito explained that this approach was mistaken, since the words of the statute clearly do not provide bail hearings for detained immigrants.

“That is not how the canon of constitutional avoidance works,” Alito wrote. “Spotting a constitutional issue does not give a court the authority to rewrite a statute as it pleases.”

The high court declined to say whether the Constitution requires bond hearings for aliens in detention. They asked the 9th Circuit to resolve that issue, and may review their determination at some future date.

The American Civil Liberties Union represents the immigrants who brought the action. They say detainees are eligible for bail under the due process clause of the Fifth Amendment.

In dissent, Breyer made technical and conceptual points. As a definitional matter, he said that the word “detain” as it appears in the relevant law has sometimes meant simply “to restrain.”

Restraint, he says, could mean subjecting an individual to a number of restrictions (forbidding travel or contact with particular persons) that don’t include confinement. Therefore, by his telling, the word detain is consistent with bail.

RELATED: Court Blocks Trump Order Keeping Illegal Aliens Out of States' Congressional Count

He also said that bail is a basic, and important, component of the Anglo-American legal tradition.

“The bail questions before us are technical but at heart they are simple,” he wrote. “We need only recall the words of the Declaration of Independence, in particular its insistence that all men and women have ‘certain unalienable Rights,’ and that among them is the right to ‘Liberty.’”

We are committed to truth and accuracy in all of our journalism. Read our editorial standards.