SACRAMENTO, Calif. (AP) — California can limit police cooperation with immigration officials and require inspections of detention facilities but can't enforce a key part of a third state sanctuary law barring private employers from allowing immigration officials on their premises without a warrant, a U.S. judge ruled Thursday.

The decision came in a lawsuit filed against the state by the Trump administration seeking to block all three laws.

In an unusual move for a federal judge, John Mendez ended his opinion with pleas that it not be viewed through a "political lens," and that Congress and the president set aside "the partisan and polarizing politics dominating the current immigration debate" to address the issue.

"There is no place for politics in our judicial system, and this one opinion will neither define nor solve the complicated immigration issues currently facing our nation," Mendez, who was nominated to the federal bench by Republican President George W. Bush, wrote in his opinion dated July 4.

Mendez's mixed ruling allowed both sides to claim victory.

"Today the federal court issued a strong ruling against federal government overreach," California Attorney General Xavier Becerra said in a statement. "The Constitution gives the people of California, not the Trump administration, the power to decide how we will provide for our public safety and general welfare."

The U.S. Department of Justice said it was disappointed that two of the laws were "not yet halted," but it called the ruling on the third law a "major victory for private employers in California who are no longer prevented from cooperating with legitimate enforcement of our nation's immigration laws."

The agency "will continue to seek out and fight unjust policies that threaten public safety," DOJ spokesman Devin O'Malley said in a statement.

The administration filed suit in March to block the laws, continuing its efforts to crackdown on so-called sanctuary jurisdictions that it says allow criminals to stay on the streets.

California has resisted the administration's effort to restrict funding to sanctuary jurisdictions if they refuse to help federal agents detain and deport immigrants. Overall, the state has sued the administration more than 50 times, mostly over immigration and environmental decisions.

The lawsuit considered by Mendez argued that the U.S. Constitution gives the federal government pre-eminent power to regulate immigration, and California can't obstruct enforcement efforts.

California said in court documents that the administration was trying to assume powers that have long been understood to belong to states and could not show that California's policies were causing harm.

Passage of the three laws followed President Donald Trump's promises to ramp up deportations.

Mendez said in Thursday's ruling that the federal government's request for a preliminary injunction presented "unique and novel constitutional issues."

"Deciding these critical issues requires this court to determine the proper balance between the twin powers of California and the United States," he wrote.

The law requiring inspections of detention facilities where immigrants are held did not "impose any substantive requirements upon detention facilities," the judge said.

"For all its bark, the law has no real bite," he wrote.

The measure preventing law enforcement from providing release dates and personal information of jail inmates — information administration officials say they need to safely remove dangerous people who are in the country illegally — is not an obstacle to federal immigration enforcement efforts, Mendez said.

The judge said "refusing to help is not the same as impeding."

But subjecting employers to monetary penalties solely because they allow immigration agents into their places of business or give them access to employment records discriminates against those who choose to deal with the federal government, the judge said.

Mendez also blocked another part of that law that prohibited employers from checking whether existing employees are authorized to work in the U.S. He left in place, however, a provision requiring employers to notify workers within 72 hours of receiving a notice of inspection from an immigration enforcement agency.

The state had asked Mendez to dismiss the lawsuit, which Democratic Gov. Jerry Brown has described as akin to the U.S. "going to war" against California.

The judge did not immediately rule on that request.

___

Thanawala reported from San Francisco.