A federal judge ruled Wednesday that the Trump administration must immediately end the deployment of the National Guard in Los Angeles, the latest legal blow to the president’s embattled efforts to police American streets with armed soldiers.

Senior U.S. District Judge Charles R. Breyer said in his ruling that command of the remaining 300 federalized National Guard troops must return to Gov. Gavin Newsom, who sued the administration in June after it commandeered thousands of troops to quell protests over immigration enforcement in Los Angeles.

On June 12, Breyer ruled that deployment illegal — a decision that was challenged and ultimately reversed by the 9th Circuit Court of Appeals. The court said the esoteric statute Trump invoked to wrest command of the Guard from the governor afforded him “a great level of deference” to determine whether a rebellion was underway in Los Angeles, as the Justice Department claimed at the time.

The same sequence repeated this autumn in Oregon, where 200 California Guard troops were sent to help quash demonstrations outside an ICE facility.

Unlike in California, the Oregon decision was vacated amid claims the Justice Department inflated the number of federal protective personnel it said were detailed to Portland and misrepresented other facts to the court.

The decision is now under review by a larger panel of the 9th Circuit, while the Supreme Court weighs an almost identical challenge to the deployment in Illinois.

In both cases, conservative judicial appointees have signaled skepticism about the president’s authority to order boots on the ground, and to keep troops federalized indefinitely.

“States are not only owed protection by the federal government, they are owed protection from it,” Judge Jay Bybee wrote in a lengthy filing Tuesday in support of the 9th Circuit review. “There is no greater threat to the sovereignty of the states than an assertion of federal control over their domestic affairs.”

The “domestic violence” clause of the Constitution was part of a careful compromise between its framers allowing the president to deploy armed soldiers against citizens “only as a last resort,” the judge argued. The president should be compelled to provide some proof of his claims and the states should be empowered to test it — “particularly in the face of contrary evidence.”

That position earned him a sharp rebuke from the court’s newest member, Trump appointee Judge Eric Tung, who echoed the administration’s claim that its deployments were “unreviewable” by the courts.

A demonstrator interacts with US marines and national guards standing in line

A demonstrator interacts with U.S. Marines and National Guard troops standing in line at the entrance of the Metropolitan Detention Center following federal immigration operations in July.

(Etienne Laurent / AFP via Getty Images)

Their exchange reflects a deepening rift on the 9th Circuit, once the most liberal appellate division in the United States.

Trump remade the 9th Circuit in his first term, naming 10 judges to the bench. Those picks were largely curated by Leonard Leo of the libertarian-leaning Federalist Society.

But Leo has since lost favor to Tung’s longtime friend Mike Davis of the Article III Project, whose recommendations tack well to the right of his predecessor, experts said.

Still, infighting on the appellate bench is far from the only hurdle facing Trump’s domestic deployments.

In October, the Supreme Court ordered both the administration and the state of Illinois to address a theory by Georgetown University law professor Martin S. Lederman, who argued the statute only allows presidents to federalize the National Guard after they send in the army.

“If the court wants to rule against Trump on this, that’s the least offensive way,” said Eric J. Segall, a professor at Georgia State College of Law. “It’s a way to avoid all factual determinations for the moment.”

But such a ruling could open the door to even more aggressive military action in the future, he and others warn.

“If the Supreme Court comes in and says, ‘you have to use the active duty military before you can use the National Guard,’ it has the effect of saying everything that happened until now [was illegal],” said David Janovsky from the Project on Government Oversight. “But then you have the prospect of more active duty troops getting deployed.”

Congress, too, is taking a fine-toothed comb to Trump’s troop cases. The Senate Armed Services Committee is set to hear testimony Thursday from military top brass about repeated domestic deployments.

“Across the United States, Donald Trump has illegally deployed our nation’s servicemembers into American cities under unclear and false pretexts and despite the costs to our military and civil rights,” Sen. Tammy Duckworth (D-Ill.) said in a statement announcing the hearing. “The American people and our troops deserve answers.”

Meanwhile, the Trump administration has continued to broaden its claims of executive power in court.

In recent weeks, Department of Justice lawyers have argued that, once federalized, state Guard troops would remain under the president’s command in perpetuity. Breyer called that position “contrary to law” in his ruling Wednesday.

“Defendants’ argument for a president to hold unchecked power to control state troops would wholly upend the federalism that is at the heart of our system of government,” Breyer wrote.

California leaders cheered Wednesday’s ruling as a turning point in what until now has been an uphill legal battle to constrain the president’s use of state troops. The order was set to take effect on Monday, though it was all but certain to be appealed to the 9th Circuit.

“The President deployed these brave men and women against their own communities, removing them from essential public safety operations,” Newsom said in a statement Wednesday morning. “We look forward to all National Guard servicemembers being returned to state service.”

Atty. Gen. Rob Bonta called it “a good day for our democracy and the strength of the rule of law.”

Still, some legal scholars and civil liberties experts warn repeated deployments — and the slogging court battles that attend them — could inure the public to further politicization of the military around the midterms.

“The sense of normalization is probably part of the plan here,” Janovsky said. “Having troops trained for war on the streets of American cities puts everyone at more risk. The more we normalize the blurring of those lines, the higher the risk that troops will be used for inappropriate purposes against the American people.”

Times staff writers Kevin Rector and Jenny Jarvie contributed to this report.