This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

A judge has ruled that California can’t require the city of Huntington Beach to follow a state law limiting local police collaboration with federal immigration agents.

Superior Court Judge James Crandall said Thursday that cities that create their own charters have a greater degree of autonomy, the Orange County Register reported.

The seaside city of 200,000 people sued the state earlier this year claiming the so-called sanctuary law interferes with its authority to enforce local laws and regulations.

California has argued that the state constitution makes charter cities — which number more than 100 and include large cities such as Los Angeles and San Diego — subject to the same state laws as other cities on matters of statewide concern.

The Democrat-led state Legislature passed the law to protect immigrants from the Trump administration’s efforts to ramp up deportations. The measure limits when police can collaborate with federal immigration agents in an effort to encourage immigrants to report crimes without fearing deportation.

The Trump administration and a series of local governments blasted the law as a public safety threat, saying police shouldn’t release immigrants convicted of crimes and subject to deportation back into local communities.

The Trump administration sued, but a federal judge in July upheld the state’s law. The Orange County city of Huntington Beach sued California and elected officials in the nearby city of Los Alamitos voted to opt out of the law, prompting a separate lawsuit by immigrant advocates.

Michael Gates, the city attorney for Huntington Beach, said Crandall’s ruling doesn’t just exempt his city from the law but all California cities that make their own charters.

“It violated charter cities’ charter authority,” Gates said. “Telling our local police what they should be doing, or need to be doing, or not to do as relates to their work in the field by the state is a tremendous overreach.”

The Police Department said it continues to cooperate with federal immigration officials.

However, “we have not, and will not, be conducting immigration enforcement in our community,” the department said in a statement. “There are times when immigration matters become important to ensuring the safety of our community, but our focus will continue to be overall public safety.”

Sameer Ahmed, staff attorney at the American Civil Liberties Union of Southern California, attended Thursday’s proceedings in Santa Ana and said he believes the ruling applies solely to Huntington Beach. There was no immediate written decision as Crandall ruled from the bench.

“I don’t think this ruling will have, or should have, a very large effect on the applicability of the law going forward,” he said.

The state is expected to appeal. Attorney General Xavier Becerra said he will continue to work to ensure the law is upheld across the state.

“Preserving the safety and constitutional rights of all our people is a statewide imperative which cannot be undermined by contrary local rules,” he said.

33.659484 -117.998803