BOSTON (Reuters) - Massachusetts police do not have the authority to detain illegal immigrants solely to buy time for federal law enforcement officials to take them into custody, the state’s top court ruled on Monday.

FILE PHOTO: The badge of a U.S. Immigration and Customs Enforcement's (ICE) Fugitive Operations team is seen in Santa Ana, California, U.S., May 11, 2017. REUTERS/Lucy Nicholson/File Photo

The decision amounts to a rejection of requests by the federal Immigration and Customs Enforcement agency for courts and law enforcement agencies to hold illegal immigrants, who are facing civil deportation orders, in custody for up to 48 hours after their cases are resolved.

The Supreme Judicial Court ruled that doing so amounts to a fresh arrest of the person that is not authorized by state law, in the first such ruling to apply to an entire state, according to Massachusetts’ attorney general.

“Massachusetts law provides no authority for Massachusetts court officers to arrest and hold an individual solely on the basis of a Federal civil immigration detainer, beyond the time that the individual would otherwise be entitled to be released from State custody,” the court wrote in its decision.

The case focused on Sreynuon Lunn from Cambodia. Federal officials said he entered the United States as a refugee in 1985 and was ordered deported to Cambodia in 2008 after a series of criminal convictions. Cambodia declined to accept him and he was released.

Lunn was arrested in Boston last year on an unarmed robbery charge and ordered released in February after prosecutors failed to present a case.

Federal ICE officials took him into custody while he remained in his holding cell, an event that made his case moot. The court agreed to hear the case on the premise that the issue would come up again.

The U.S. Justice Department had argued that the 48-hour detainer requests reflected basic practices of cooperation between various law enforcement agencies.

Attorneys for Lunn and the state had largely agreed that Massachusetts lacked the authority.

“This decision allows local law enforcement to focus their resources on keeping people safe,” said Massachusetts Attorney General Maura Healey, in a statement.

U.S. President Donald Trump has made cracking down on illegal immigration a top priority of his administration.

The American Civil Liberties Union of Massachusetts praised the decision.

“At a time when the Trump administration is pushing aggressive and discriminatory immigration enforcement policies, Massachusetts is leading nationwide efforts by limiting how state and local law enforcement assist,” the group’s executive director, Carol Rose, said in a statement.

ICE did not immediately respond to a request for comment.