A federal judge in Sacramento partially blocked one of California’s “sanctuary state” laws, but upheld two others, on Thursday.

The U.S. Department of Justice (DOJ) filed a challenge in March against the Inspection and Review of Facilities Housing Federal Detainees law (AB 103); the Immigrant Worker Protection Act (AB 450); and the California Values Act (SB 54). Attorney General Jeff Sessions traveled specially to Sacramento for the filing.

Judge John Mendez, a George W. Bush appointee, declined the state’s request in April to transfer the case to a more liberal federal court San Francisco. That was thought to be a good sign for the Trump administration’s case, but the judge ruled largely in the state’s favor Thursday, upholding AB 103 and SB 54, while blocking enforcement of portions of AB 450.

Experts had predicted SB 54 would be upheld and that AB 450 would be struck down, but had also predicted that AB 103 would be unlikely to survive.

DOJ spokesman Devin O’Malley provided a comment via e-mail to Breitbart News, calling the ruling on AB 450 a “major victory,” but expressing disappointment in the court’s ruling on AB 103 and SB 54:

When they passed SB 54, AB 103, and AB 450, California’s political leadership clearly intended to obstruct federal immigration authorities in their state. The preliminary injunction of AB 450 is a major victory for private employers in California who are no longer prevented from cooperating with legitimate enforcement of our nation’s immigration laws. While we are disappointed that California’s other laws designed to protect criminal aliens were not yet halted, the Justice Department will continue to seek out and fight unjust policies that threaten public safety.

In his ruling, Judge Mendez wrestled with the question of whether the Constitution’s Supremacy Clause barred the state’s attempts to restrict federal enforcement of immigration laws within the state. The judge also considered whether the Tenth Amendment to the Constitution reserved California’s right to deny assistance to the federal government as it sought to enforce immigration laws.

(His decision only affected the application of DOJ for a preliminary injunction against the state’s effort to enforce its sanctuary laws; the final merits of the case are still yet to be decided later in the legal process.)

With regard to AB 103, under which California subjected federal immigration detention facilities to state inspection, Judge Mendez held: “The Court finds no indication in the cited portions of the [Immigration and Nationality Act] that Congress intended for States to have no oversight over detention facilities operating within their borders.” The specific federal contracts for the operation of the facility, the judge further reasoned, “demonstrate that California retains some authority over the detention facilities.” In allowing the state to review the condition of federal facilities, the judge wrote, the law did not allow the state to do very much at all: “For all its bark, the law has no real bite.” Other provisions of the law, Judge Mendez, created no real conflict with federal law.

In considering AB 450, which prevents private employers from cooperating with federal immigration law enforcement officials voluntarily, Judge Mendez found the task of balancing state and federal authority more difficult. “The Court finds AB 450’s prohibitions on consent … troubling due to the precarious situation in which it places employers,” he wrote. “Irrespective of the State’s interest in protecting workers, the Court finds that the warrant requirement [of AB 450] may impede immigration enforcement’s investigation of employers or other matters within their authority to investigate.” However, he added that state and federal law did not necessarily conflict: “Congress has not expressly authorized immigration officers to enter places of labor upon employer consent, nor has Congress authorized immigration enforcement officers to wield authority coextensive with the Fourth Amendment.”

Ultimately, Judge Mendez blocked AB 450’s monetary penalties on employers who comply with the federal government, because he found such fines violated the Supremacy Clause “under the intergovernmental immunity doctrine,” which prevents states from discriminating against the federal government or those residents who choose deal with it. He also blocked enforcement of a provision of the California law that prevents employers from voluntarily re-verifying the immigration status of employees.

Finally, on SB 54 — the most controversial of California’s “sanctuary state” laws — Judge Mendez declined to agree with DOJ. He upheld a section of the law preventing the state from assisting the federal government by providing the release dates of illegal aliens detained by state and local law enforcement. According to Judge Mendez, the state law did not, in fact, conflict with federal law, which he interpreted as merely requiring the states to provide the citizenship status of detainees.

Judge Mendez later added: “California’s decision not to assist federal immigration enforcement in its endeavors is not an “obstacle” to that enforcement effort … refusing to help is not the same as impeding.” If it were, the Tenth Amendment would be meaningless, he suggested. Congress had not specifically indicated a “clear and manifest purpose to preempt state law” in the relevant federal immigration laws.

Judge Mendez also accepted the state’s argument that helping the federal government enforce immigration law would hurt public trust in local law enforcement, and hence local public safety.

The judge concluded:

This Court has gone to great lengths to explain the legal grounds for its opinion. This Order hopefully will not be viewed through a political lens and this Court expresses no views on the soundness of the policies or statutes involved in this lawsuit. 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.

If there is going to be a long-term solution to the problems our country faces with respect to immigration policy, it can only come from our legislative and executive branches. It cannot and will not come from piecemeal opinions issued by the judicial branch. Accordingly, this Court joins the ever-growing chorus of Federal Judges in urging our elected officials to set aside the partisan and polarizing politics dominating the current immigration debate and work in a cooperative and bi-partisan fashion toward drafting and passing legislation that addresses this critical political issue. Our Nation deserves it. Our Constitution demands it.

Neither California Governor Jerry Brown nor Attorney General Xavier Becerra had commented on the ruling by Thursday afternoon.

Joel B. Pollak is Senior Editor-at-Large at Breitbart News. He is a winner of the 2018 Robert Novak Journalism Alumni Fellowship. He is also the co-author of How Trump Won: The Inside Story of a Revolution, which is available from Regnery. Follow him on Twitter at @joelpollak.