CNN  — 

A federal judge in California largely rejected an effort by the Trump administration to block a spate of immigration laws in the state in a ruling issued Thursday, dealing a setback to the Justice Department in its offensive against “sanctuary city” policies.

In an opinion, Judge John Mendez, a George W. Bush appointee, turned down Justice Department demands to stop the 2017 California laws that prevented state law enforcement from sharing information about the release of criminal immigrants to federal agents and that prohibited their transfer to federal custody. Mendez also ruled that a plan for state inspection of detention facilities holding noncitizens for civil immigration proceedings, which included the review of certain federal immigration documents, could move forward for now, as well as a new labor code that required private employers to give workers advance notice of potential worksite inspections.

Mendez did, however, block California from carrying out other sections of the new laws, including prohibiting private employers from voluntarily allowing immigration authorities to enter nonpublic areas of their workplaces. Mendez also granted the government’s request to block a section of the California law limiting an employer’s ability to reverify the legal work status of an employee.

In a statement, California Attorney General Xavier Becerra called the opinion a “strong ruling against federal government overreach.”

“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. California’s laws work in concert – not conflict – with federal law,” Becerra said.

California passed the laws last year in what officials hailed as a rebuke of President Donald Trump’s aggressive immigration enforcement agenda.

In a statement, Justice Department spokesman Devin O’Malley hailed the preliminary injunction on the law that stopped private employers from cooperating with immigration authorities as a “major victory,” but expressed disappointment in the bulk of the ruling.

“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,” O’Malley said.

Closing out his 60-page opinion, Mendez implored Congress and the White House to come up with solutions to “the problems our country faces with respect to immigration policy,” writing that one “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,” Mendez wrote.

CNN’s Marc Rod contributed to this report.