U.S. District Judge Nicholas Garaufis in Brooklyn ruled that the Deferred Action for Childhood Arrivals programme, or DACA, can not end in March as the Republican administration had planned, a victory for Democratic state attorneys general and immigrants who sued the federal government.
Judge Garaufis is the second federal judge to rule Mr. Trump's aides bungled the phaseout, following a case in a federal court in California.
The judge said the Trump administration can still rescind the program in the future if it does it the right way.
In September, Trump said he was scrapping the DACA program but delayed enforcement to give Congress six months - until March - to craft a lasting solution for the program recipients, informally known as "Dreamers".
"It's not just an ad hoc comment that was overheard on an open mic", the judge said.
On Friday, the Supreme Court will consider whether to take on the issue.
The justices are weighing that request.
These two injunctions, plus heavy resistance from Democrats, could keep the program running past Trump's March 5 deadline. "Because that conclusion was erroneous, the decision to end the DACA program can not stand". The DREAM Act - Development, Relief and Education for Alien Minors - was legislation that offered numerous same protections as the Deferred Action for Childhood Arrivals administrative program but never passed Congress.
Trump a year ago announced his plan to end DACA, the policy that allowed undocumented immigrants brought to the U.S. as children to stay in the country, effective March 5.
Garaufis cautioned his ruling does not hold that DACA's rescission is unlawful, and left open the possibility that the government may legitimately revoke the policy at some point in the future.
"Federal courts from coast to coast have now reviewed the record and reached the same conclusion: President Trump's decision to rescind DACA was illegal". They said it was more humane to do a six-month phaseout than to have a court end the program abruptly. That program granted the right to work and stay in the USA without fear of deportation to about 700,000 young immigrants.