A federal judge in Sacramento repeatedly pressed the U.S. Justice Department on Wednesday to explain how California's so-called sanctuary laws improperly hamper federal immigration enforcement.

U.S. District Judge John Mendez of the Eastern District of California peppered the government's legal team, led by Chad Readler, with a range of questions exploring the interplay between California's laws and federal power.

The hearing, more than five hours long, resembled more of a trial at times than an injunction hearing. Mendez dove into minute details of the case, asking lawyers for relevant case law, citing arguments from the many amicus briefs, questioning the severability of provisions in state statutes and quizzing the sides with long lists of what appeared to be prepared questions.

The Justice Department wants, among other things, Mendez to strike down a California law that allows the state attorney general to inspect federal detention facilities. Federal officials, who sued the state in March, say the measure unlawfully intrudes on their immigration enforcement duties.

State visits to facilities, records reviews and conversations with employees and detainees do “not affect your client's decisions on who is and isn't removable,” Mendez told Readler, the acting head of the Justice Department's Civil Division and a Trump nominee to the U.S. Court of Appeals for the Sixth Circuit. “This is just a review, right?”

Readler argued the presence of a state prosecutor alone diverts the time and attention of facility staff.

“What is the burden?” Mendez asked, noting that the state has already inspected five of nine detention centers under the new law and neither the federal government nor their facility contractors sought a court order to block the state attorney general's entrance.

“It's just a review,” the judge said. “It adds transparency to a process. In my view, more transparency is better when we deal with the government.”

The Justice Department's lawsuit challenges three laws California adopted last year in response to the Trump administration's broad crackdown against immigration. U.S. Attorney General Jeff Sessions is seeking a preliminary injunction, arguing that California's laws infringe the federal role enforcing immigration laws.

The legal dispute crystalizes the political battle between California and Trump, with the state acting as the West Coast blue resistance to a Republican federal government that wants major changes to immigration policy.

California laws now require employers to bar federal immigration agents from private workplace sites unless they have a warrant. Another law, which has generated opposition from several sheriffs and police chiefs, limits state and local agencies' cooperation with immigration officials in certain circumstances.

“This whole case in many ways is the state saying, 'We're not going along with this anymore,'” Mendez said at one point during the hearing. “'We're not participating and there's nothing you can do about it.'”

Mendez had tough questions for state lawyers about a state law that threatens employers with fines if they allow federal agents to conduct immigration sweeps in non-public work sites.

“The statute really puts an employer between a rock and a hard place,” he said. Companies face civil penalties for not complying with state laws and criminal sanctions if they knowingly employee undocumented workers.

“It seems inherently unfair to me that the state of California can put an employer in that position,” Mendez said.

Arguing for the state, Deputy Attorney General Christine Chuang said she disagreed “with the underlying premise” that employers would always choose to cooperate with warrantless inspections by federal immigration agents.

Mendez told the parties he had no inclination to limit the record in a case that will be appealed by one side or the other.

The broad interest in the case led the court to open two overflow courtrooms for reporters, the public and representatives of the many interest groups that had filed amicus briefs. “We may be the last ones left in the courtroom,” Mendez joked at one point, hours into the hearing.

Read more: