A US appeals court blocked President Donald Trump today from immediately ending an Obama-era programme shielding young immigrants known as "Dreamers" from deportation, saying the administration's decision to phase it out was arbitrary because it was based on a flawed legal theory.
A three-judge panel of the 9th US Circuit Court of Appeals unanimously kept a preliminary injunction in place against Mr Trump's decision to end the Deferred Action for Childhood Arrivals programme.
Lawsuits by California and others challenging the administration's decision will continue in federal court while the injunction stands.
The US Supreme Court could eventually decide the fate of DACA, which has protected some 700,000 people who were brought to the US illegally as children or came with families that overstayed visas.
In today's ruling, 9th Circuit Judge Kim Wardlaw said California and other plaintiffs were likely to succeed with their claim that the decision to end DACA was arbitrary and capricious.
She said the court was not trying to infringe on the president's power to enforce immigration law but wanted to enable the exercise of that authority "in a manner that is free from legal misconceptions and is democratically accountable to the public".
The Trump administration has said it moved to end the programme last year because Texas and other states threatened to sue, raising the prospect of a chaotic end to DACA. The administration cited a 2015 ruling by another US appeals court that blocked a separate immigration policy implemented by President Barack Obama.
The 9th Circuit disagreed with the New Orleans-based 5th US Circuit Court of Appeals and said one of its conclusions did not apply to DACA.
The administration's belief that DACA exceeded Obama's authority and was illegal was therefore "incorrect", the court said.
An email to the US Department of Justice was not immediately returned.
Mr Trump's decision to end DACA prompted lawsuits across the nation, including one by California. A judge overseeing that lawsuit and four others ruled against the administration and reinstated the programme in January.
US District Judge William Alsup rejected the argument that then-President Barack Obama had exceeded his power in creating DACA and said the Trump administration failed to consider the disruption that ending the programme would cause.
The administration then asked the 9th Circuit to throw out Judge Alsup's ruling.
During a hearing in May, Deputy Assistant Attorney General Hashim Mooppan argued that the courts could not review the administration's decision to end DACA and defended the move against assertions that it was arbitrary and capricious.
"It's a question of an agency saying, 'We're not going to have a policy that might well be illegal,'" Mr Mooppan told the judges. "That is a perfectly rational thing to do."
Mr Mooppan said the administration was under no obligation to consider the fact that people had come to rely on DACA.
The judges on the 9th Circuit panel appeared sceptical of the argument that the DACA decision was beyond the court's authority to review.
Judge Jacqueline Nguyen questioned the government's contention that a DACA decision was beyond the authority of the court. She also disagreed with the argument that DACA isn't legal.
The administration has been critical of the 9th Circuit and took the unusual step of trying to sidestep it and have the California DACA cases heard directly by the US Supreme Court. The high court in February declined to do so.
Federal judges in New York and Washington also have ruled against Trump on DACA.