The court's majority opinion was delivered by Justice Samuel Alito.
The San Francisco-based 9th US Circuit Court of Appeals, a liberal-leaning court Trump has slammed in other cases, ruled in 2016 that convicted immigrants who are not immediately detained by immigration authorities after finishing their sentences can not later be placed into indefinite detention awaiting possible deportation.
Associate Justice Stephen Breyer wrote the dissent for the court's liberals - and in a rare move, delivered it from the bench, U.S. media reported. But unlike with most rights guaranteed by the first 10 amendments, states have not been compelled to follow suit and require unanimous juries in all state cases.
The court ruled 5-4 along ideological lines, with its conservative justices in the majority and its liberal justices dissenting, that federal authorities could place such immigrants into indefinite detention anytime without the possibility of bail, not just immediately after they finish prison sentences.
Alito wrote that it is "especially hard to swallow" the notion that "the alien must be arrested on the day he walks out of jail".
While the Obama administration held the same view of the law, it has become more important for the Trump administration, which has stepped up deportation enforcement and complained that policies of "sanctuary cities" hinder its ability to learn of the release of those whose crimes make them deportable. Alito noted that the court has said in the past that "an official's crucial duties are better carried out late than never".
The 9th Circuit said such immigrants could seek bond hearings to argue for their release. In each case, litigation against the federal government started before Trump took office.
New Zealand to reform gun law in 10 days
A government-funded gun buyback and a virtual ban on owning semi-automatic rifles cut private gun ownership by nearly a third. There have also been calls for a gun register, which isn't required in New Zealand for most firearms, according to the BBC .
In the case before the justices, a group of mostly green card holders argued that unless they were picked up immediately after finishing their prison sentence they should get a hearing to argue for their release while deportation proceedings go forward.
A Virginia court past year vacated Malvo's sentences and asked a trial court to rule on whether his crimes reflect permanent incorrigibility or "the transient nature of youth".
Warren also said that steps should be taken to depoliticizing the court, mentioning bringing in appellate judges on cases as an option.
In one case, Mony Preap, a legal permanent resident from Cambodia was arrested and convicted of marijuana possession in 2006.
American Civil Liberties Union Deputy Legal Director Cecillia Wang, who argued the case at the Supreme Court, said the case was reminiscent of a case last term in which the court limited the ability of immigrants to object to their detention.
In 2016, the Supreme Court held in Montgomery v. Louisiana that the Miller ruling "announced a substantive rule of constitutional law" that must be given "retroactive effect" in cases where direct review was complete at the time Miller was decided.