A federal judge in California has ruled that President Donald Trump's deployment of the National Guard to Los Angeles this summer was illegal.
The ruling comes as Trump seeks to use National Guard troops in order to crack down on crime in other US cities and support immigration enforcement.
Trump deployed National Guard troops to Los Angeles in June in response to protests against immigration raids.
US District Judge Charles Breyer ruled on Tuesday that the government had violated the Posse Comitatus Act, which limits the power of the federal government to use military force for domestic matters.
Judge Breyer has put the ruling on hold until 12 September and Trump will likely appeal.
The president has already deployed hundreds of National Guard troops in Washington DC and is weighing dispatching troops to Chicago as soon as this week.
After Trump deployed troops to Los Angeles, Governor Gavin Newsom sued the administration for alleged violations of the Posse Comitatus Act.
Judge Breyer's order only applies in California, but could signal legal challenges ahead for Trump's plans to use the Guard to enforce his policies.
"President Trump's recent executive orders and public statements regarding the National Guard raise serious concerns as to whether he intends to order troops to violate the Posse Comitatus Act elsewhere in California," Judge Breyer wrote.
He warned that Trump and Defense Secretary Pete Hegseth ran the risk of "creating a national police force with the President as its chief".
He blocked the National Guard from executing the following laws including "engaging in arrests, apprehensions, searches, seizures, security patrols, traffic control, crowd control, riot control, evidence collection, interrogation, or acting as informants".
The White House, Defense Department, and Justice Department did not immediately respond to request for comment.
This is the second lawsuit filed by Newsom against the deployment of National Guard troops in Los Angeles.
The first lawsuit sought to wrest back control of California's National Guard contingent, after Newsom alleged Trump had unlawfully circumvented him to deploy the troops.
Judge Breyer, who also handled that case, ruled in Newsom's favour, but the Ninth Circuit Court of Appeals ruled in favour of Trump.