The state Supreme Court denied review Wednesday of a lower-court ruling requiring all California cities to follow the state's sanctuary law, which prohibits most types of law enforcement cooperation with federal immigration agents.

SB54, signed by Gov. Jerry Brown in 2017, bars state and local police from asking arrestees about their immigration status, from notifying federal agents about an immigrant's upcoming jail release, or from holding an immigrant beyond the scheduled release date for transfer to immigration officers. It does not apply to immigrants charged with serious crimes.

Some local governments, including the Orange County and San Diego County boards of supervisors, supported the Trump administration's unsuccessful suit in 2018 that claimed the state law conflicted with federal law.

But the only city that sued to overturn the law was Huntington Beach, a coastal community of 200,000 in Orange County. City officials said SB54 interfered with local law enforcement by limiting police cooperation with immigration officers.

An Orange County judge ruled in favor of Huntington Beach in September 2018 and said the law violated the city's authority to regulate municipal affairs under the city charter. The ruling, if upheld, would have allowed any of California’s 121 charter cities, including its largest cities, to exempt themselves from SB54, while leaving other cities bound by the law.

But the state's Fourth District Court of Appeal in Santa Ana overturned the ruling in January and said the law regulates issues of "statewide concern" that outweigh local interests.

In the 3-0 ruling, Justice Richard Fybel said the Legislature, in enacting SB54, had made findings that undocumented immigrants were reluctant to report crimes to police, and sometimes to attend school or seek health care, if they believed local officers were working with immigration agents.

Fybel said the law also protects immigrants' constitutional rights, "a matter of paramount statewide concern."

Huntington Beach City Attorney Michael Gates said the ruling was at odds with provisions in the state Constitution that allow charter cities to regulate their police departments.

But the state's high court unanimously denied review of the city's appeal Wednesday, making the appeals court decision final and binding on trial courts statewide.

The case is Huntington Beach vs. Becerra, S260766.

Bob Egelko is a staff writer for The San Francisco Chronicle. E-mail: begelko@sfchronicle.com