California’s sanctuary law, which prohibits most types of law enforcement cooperation with federal immigration agents, is binding on the state’s 121 charter cities, including an Orange County community that has refused to enforce it, a state appeals court ruled last week.

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

When the Trump administration unsuccessfully sued California in 2018, claiming SB54 conflicted with federal immigration law, some local governments in the state supported the suit, including the Orange County and San Diego County boards of supervisors and many of their cities.

But the only city that has challenged the law in court so far is he coastal community of Huntington Beach, with a population of 200,000. City officials said SB54 interfered with local law enforcement by limiting police authority to work cooperatively with immigration officers.

An Orange County judge ruled in favor of Huntington Beach in September 2018, saying the law violated the city’s authority to regulate municipal affairs under the city charter — a ruling, that, if upheld, would allow California’s 121 charter cities, including its largest cities, to exempt themselves from SB54. But the Fourth District Court of Appeal in Santa Ana disagreed Friday and said the law regulates issues of “statewide concern” that outweigh local interests.

“Law enforcement agencies throughout the state interact with immigrants,” Justice Richard Fybel said in the 3-0 ruling. He 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.

The line between local and state interests can be difficult to draw, Fybel said, citing state Supreme Court rulings exempting charter cities from state laws that prohibited public financing of election campaigns and required arbitration in labor disputes involving police and firefighters. But he noted that state courts had required all cities to comply with minimum-wage laws and with a law on police officers’ employment rights.

“The fact that California is highly urbanized and integrated makes uniform statewide application of the CVA all the more critical,” Fybel said, referring to the California Values Act, the label used by sponsors of SB54. And he said the law also protects immigrants’ constitutional rights, “a matter of paramount statewide concern.”

Huntington Beach City Attorney Michael Gates said he would ask the City Council to authorize an appeal to the state Supreme Court.

“A decision like this rewrites, if not undermines, portions of the (California) Constitution that provide charter cities like Huntington Beach the authority to govern the police department,” Gates said in an interview. “The Legislature is getting more and more aggressive over matters of local governance.”

Jessica Bansal, an American Civil Liberties Union attorney, said the ruling “affirms that all Californians— including the millions living in charter cities — are entitled to the California Values Act’s protections.”

Bob Egelko is a San Francisco Chronicle staff writer. Email: begelko@sfchronicle.com Twitter:@BobEgelko