The US Supreme Court has rejected President Trump's cancellation of the DACA programme protecting 700,000 "Dreamers," undocumented migrants brought to the United States as children.
The high court said President Trump's 2017 move to cancel his predecessor Barack Obama's landmark Deferred Action for Childhood Arrivals programme was "arbitrary and capricious" under government administrative procedures.
The judgment on a five-to-four vote, with Chief Justice John Roberts siding with the court's four liberal members, stressed that it was not an assessment of the correctness of the 2012 DACA programme itself.
Instead, they said the Trump administration had violated official government procedures in the way they sought to quickly rescind DACA in September 2017 based on weak legal justifications.
The ruling means that the roughly 649,000 immigrants, mostly young Hispanic adults born in Mexico and other Latin American countries, currently enrolled in DACA will remain protected from deportation and eligible to obtain renewable two-year work permits.
The ruling does not prevent President Trump from trying again to end the programme. But his administration is unlikely to be able to end DACA before the 3 November election in which Donald Trump is seeking a second four-year term in office.
The decision came three and a half years after Donald Trump entered office promising to halt almost all immigration and to expel the more than 10 million people estimated living in the country, many for decades, without legal immigration documents.
The Obama administration had sought to address this issue in 2012 with the DACA policy offering protection at renewable two-year periods, including authorisation to work, to people brought into the United States illegally as children and then growing up there.
Responding to the court's decision, President Trump cirticised the court for what he said were "horrible & politically charged" decisions.
On Twitter, President Trump said the court was biased against conservatives, saying their decisions were "shotgun blasts into the face of people that are proud to call themselves Republicans".
"Do you get the impression that the Supreme Court doesn't like me?" Mr Trump asked.