A federal judge in California late Tuesday temporarily blocked the Trump administration's efforts to end the Deferred Action for Childhood Arrivals program.
Judge William Alsup also said the administration must resume receiving DACA renewal applications.
But the ruling is limited -- the administration does not need to process applications for those who have never before received DACA protections, he said.
The Trump administration announced the move to draw down the program last September with a planned end for early March. DACA protected young undocumented immigrants who came to the US as children from deportation.
The fate of DACA and the roughly 700,000 "Dreamers" is the subject of heated negotiations in Washington, where President Donald Trump, Republicans and Democrats are searching for a way to allow Dreamers to stay while also addressing border security concerns. It is not clear how the order will impact those talks.
The ruling came in a challenge to the Department of Homeland Security brought by the University of California and others.
In his 49-page ruling, Alsup said "plaintiffs have shown that they are likely to succeed on the merits of their claim that the rescission was arbitrary and capricious" and must be set aside under the federal Administrative Procedures Act.
The judge said a nationwide injunction was "appropriate" because "our country has a strong interest in the uniform application of immigration law and policy."
"Plaintiffs have established injury that reaches beyond the geographical bounds of the Northern District of California. The problem affects every state and territory of the United States," he wrote.
In response to the ruling, the Department of Justice questioned the legality of DACA, calling it "an unlawful circumvention of Congress." DOJ spokesman Devin O'Malley said that DHS "acted within its lawful authority in deciding to wind down DACA in an orderly manner" and implied that the legal battles aren't over yet.
"The Justice Department will continue to vigorously defend this position, and looks forward to vindicating its position in further litigation," O'Malley said.
'A huge step in the right direction'
California's Attorney General Xavier Becerra hailed the ruling as a "a huge step in the right direction" in a statement. A coalition of attorneys general, including Becerra had also filed suit against the federal government over ending DACA, maintaining that it would cause "irreparable harm to DACA recipients."
In contrast, Mark Kirkorian, the executive director of Center for Immigration Studies, a think tank that advocates for lower immigration, described the ruling as "our lawless judiciary" in a tweet.
The plaintiff, the University of California said in a statement it was "pleased and encouraged" by the judge's ruling, which would allow DACA recipients to stay in the US as the lawsuits make their way through the courts.
"Unfortunately, even with this decision, fear and uncertainty persist for DACA recipients," said Janet Napolitano, president of the UC school system and was the Secretary of Homeland Security in 2012 who established DACA.
While the ruling that orders DACA renewals is "a sigh of relief," it's a fleeting one, said Karen Tumlin, legal director of the National Immigration Law Center, which advocates for rights of immigrants.
"It is important to remember, however, this is temporary relief by a single federal district court judge, it should not take the pressure off of Congress to do the right thing and enact a permanent solution for these young people."
Lawmakers are racing toward a January 19 deadline for government funding and a host of issues, including DACA are tied to the negotiations.
"Dreamers deserve permanence they can count on, not legal thrillers. Congress needs to bring that home," tweeted Tumlin.