WASHINGTON – The Supreme Court agreed Monday to decide another case testing the administration's authority to arrest and jail immigrants facing deportation, including long-time lawful residents who committed minor offenses years ago.

The justices will review a class-action ruling from California that held that immigrants who were released after serving time in local and state jails may not be detained later by federal border agents for possible deportation and held indefinitely without a hearing, if they pose no danger to the public and are not likely to flee.

Administration lawyers appealed the ruling of the 9th U.S. Circuit Court of Appeals, arguing that federal law calls for "mandatory detention" for all noncitizens who face possible deportation because of a criminal record.

They said the 9th Circuit's approach will lead to a "gap in custody" and "frustrate the [government's] ability to remove deportable criminal aliens from the United States." And they placed part of the blame on "state and local jurisdictions [who] do not always cooperate" with federal efforts to arrest immigrants who are leaving jails.

The case, to be heard in the fall, sets up another clash between "sanctuary" cities and counties and federal immigration agents who seek to detain and deport immigrants who have criminal records.

In deciding the case, the 9th Circuit said that more than 30,000 noncitizens are held every day in the United States in "prison-like conditions" while they challenge the government's efforts to deport them. The judges said the mandatory detention rule covers those with a "broad range of crimes" on their records, from violent felonies to simple drug possession.

And it applies to longtime, lawful residents who have lived and worked in the United States for decades, they said.

The lead plaintiff in the challenge to this provision, Mony Preap, was born in a Cambodian refugee camp and has been a lawful permanent resident since 1981. He was convicted on two counts of marijuana possession in 2006, a misdemeanor offense. Agents of the Department of Homeland Security took him into custody in 2013 under the disputed part of the immigration law. It says DHS "shall take into custody any alien" who was convicted of a "deportable" offense "when the alien is released."

Preap joined a class-action suit brought by the American Civil Liberties Union to challenge the government's view that he was subject to mandatory detention seven years after his release.

A federal judge in San Francisco and the 9th Circuit Court agreed with the challengers and said the phrase "when the alien is released" referred only to the time of their release. Because Preap had been released years earlier, he was not subject to mandatory detention in 2013 for the past offenses, the appeals court said.

The Supreme Court kept the government's appeal on hold while it decided a related case. In Jennings vs. Rodriguez, the court ruled last month that federal law did not give jailed immigrants a right to a bail hearing after six months in custody.

However, the justices sent that case back to the 9th Circuit to rule on whether indefinite detention without a hearing violated the Constitution.