(Reuters) - The Trump administration lost a court bid on Thursday aimed at striking down California’s “sanctuary” statutes that prevent local law enforcement from helping the U.S. government’s crackdown on illegal immigration.

FILE PHOTO: California Attorney General Xavier Becerra speaks about President Trump's proposal to weaken national greenhouse gas emission and fuel efficiency regulations, at a media conference in Los Angeles, California, U.S. August 2, 2018. REUTERS/Lucy Nicholson

(graphic: tmsnrt.rs/2XmGDDg)

The U.S. 9th Circuit Court of Appeals in San Francisco largely affirmed a July ruling from a lower court, which had found the California laws do not conflict with federal immigration rules.

The U.S. Department of Justice did not immediately respond to a request for comment.

California’s Attorney General Xavier Becerra said in a statement, “We continue to prove in California that the rule of law not only stands for something but that people cannot act outside of it.”

Scores of Democrat-controlled cities and counties have adopted policies to limit cooperation with federal immigration enforcement, making them a target for President Donald Trump. He recently suggested he would send an “unlimited supply” of migrants in the country illegally to sanctuary cities.

The Trump administration has also tried to deny public safety grants to some sanctuary cities, a policy that has been generally blocked by federal courts.

The California laws prohibit private employers in the state from voluntarily cooperating with federal immigration officials and bar local law enforcement from sharing information about the release of illegal immigrants from custody.

The appeals court reversed the lower court regarding a part of a third law, which empowers the California attorney general to monitor conditions in immigrant detention facilities. The Court of Appeals said the requirement that an inspection of the circumstances surrounding the apprehension and transfer of an immigrant discriminates against the federal government.

The Court of Appeals directed the U.S. District Court in Sacramento to review that part of its ruling.

The case stems from a March 2018 lawsuit by the Department of Justice, which contended that the laws violated the U.S. Constitution.