Aug. 14 (UPI) — A federal judge in a bench trial over the federal government’s use of the California National Guard in Los Angeles in response to protests against President Donald Trump‘s immigration policies asked federal attorneys pointed questions about the legality of using the troops.

The case is being heard in San Francisco by U.S. District Judge Charles Breyer, who asked the questions about what limits there are against using federal law enforcement to protect federal buildings, which the U.S. Department of Justice claims is the reason for the almost 300 Guard troops still deployed in the state.

Trump deployed 4,000 guard troops and 700 Marines to the city in June. He said they were needed to protect federal property and law enforcement agents during the protests. Gov. Gavin Newsom rejected the use of his state’s Guard and sued the federal government asking for an injunction that would limit the role of the federal government in the city.

The judge’s comments came on the third and final day of the trial.

“Once you have a force in place, and maybe legitimately do so, and the threat that gave rise to the force in that place subsides, or is no longer of serious concern, what then?” Breyer asked a Justice Department attorney Wednesday. “How does one look at this national police force, which goes out of where the threat was and starts executing other laws?”

“It’s not that I’m sitting here insensitive to the risk of federal employees,” he added. “I’m trying to see whether there are limits, any limits, to the use of federal force to ameliorate that risk.”

Newsom got a win in June with Breyer, but a federal appeals court said that the president can keep control of the federalized Guard while the legal case continues.

One of Newsom’s claims is that the troops violated the Posse Comitatus Act. It’s an 1878 law that bans the use of the U.S. military for domestic law enforcement.

Eric Hamilton, a Justice Department lawyer, argued that there is no precedent for the lawsuit, for injunctive relief or money damages under the act. He said that Newsom and California have not suffered the harm required to sue.

But California Deputy Attorney General Meghan Strong, representing the state, said the government has never used the military this way before.

“It is, in fact, the federal government who is engaged in unprecedented conduct,” she said.

“So then what is the remedy?” Breyer asked Hamilton, mentioning presidential immunity from criminal prosecution. “You’re saying there’s a criminal remedy? The president can be prosecuted? You say that in light of the Supreme Court decision, the Trump decision. Isn’t he immune?”

“So that’s it. Too bad. So sad. It’s over,” he said. “And that’s the end of the case.”

Josh Kastenberg, a professor at the University of New Mexico Law School, told CBS News that Newsom’s lawsuit is a longshot.

“The constitution and the law and the facts are on Governor Newsom’s side. But that doesn’t mean he’s going to win. Ever since World War II, the courts have embraced this military deference doctrine, which really is presidential deference in matters of military command and control.”

Breyer did not give a timeline for his ruling.