Image copyright Reuters

The Supreme Court has given the Trump administration an immigration policy victory by ruling criminal noncitizens can be detained at any time.

The 5-4 ruling states federal officials may detain convicted immigrants indefinitely after they finish serving prison time, even years after.

Advocates had argued the law only allowed for detention immediately after immigrants were released from prison.

The court's liberal justices dissented from the conservative decision.

Tuesday's ruling reversed a lower court decision that had found the existing law to mean federal authorities must detain convicted immigrants within 24 hours of their release from criminal detention.

Civil rights lawyers had claimed after that deadline, immigrants should be permitted a bond hearing so they were not forced to remain in custody indefinitely while their deportation case went forward.

The Trump administration, however, said the government should be allowed to hold convicted noncitizens at any time - and the conservative-majority top court has agreed.

In the conservative opinion, Associate Justice Samuel Alito said the strict ruling was to ensure homeland security officials were not constrained by inappropriate deadlines to detain convicted noncitizens.

"As we have held time and again, an official's crucial duties are better carried out late than never," he wrote, adding that such a tight deadline was often not feasible logistically speaking.

Justice Alito also noted that it was not meant to target noncitizens who had served time and continued to lead legal lives in their communities, and said the decision still allows for those individuals to challenge the law on constitutional grounds if they are detained.

Associate Justice Stephen Breyer wrote the dissent for the court's liberals - and in a rare move, delivered it from the bench, US media reported.

"The greater importance of the case lies in the power that the majority's interpretation grants the government," Justice Breyer said in his summary.

"It is a power to detain persons who committed a minor crime many years before. And it is a power to hold those persons, perhaps for many months, without any opportunity to obtain bail."

The case brought before the top court was a California class-action lawsuit by a group of noncitizens, most with permanent residency cards, whose lawyers argued they should be entitled to a hearing if they were detained by federal authorities more than a day after their release from prison.

Lead plaintiff Mony Preap was a legal resident who had two convictions involving marijuana possession. He was taken into federal custody in 2013, years after serving his prison time, but eventually won his deportation case, the Associated Press reported.