The president attacked the decision via Twitter on Wednesday, saying it showed the justice system was "broken and unfair."

Under the order from US District Judge William Alsup, the Trump administration must resume accepting renewal applications from individuals who were already enrolled in the program. Alsup did not order the administration to accept new applications, however, writing that the plaintiffs had shown only that existing recipients were likely to suffer "irreparable harm" absent immediate intervention from the court.

The Obama-era program, which Trump moved to end in September, had provided protection against deportation for nearly 800,000 young undocumented people brought to the country as children.

A federal judge in San Francisco on Tuesday night ordered the Trump administration to partially revive the Deferred Action for Childhood Arrivals program, finding that challengers to the administration's decision to end the program were likely to succeed in their claims that President Trump’s move was "arbitrary and capricious."

It just shows everyone how broken and unfair our Court System is when the opposing side in a case (such as DACA) al… https://t.co/sXFgY5c11s

Trump's earlier statements in support of the DACA program ended up hurting the government's case in court. In finding that it was in the public’s interest to at least partially continue the program for now, the judge cited tweets from Trump that appeared to express support for DACA’s goals, including a Sept. 14 tweet , just over a week after Trump announced the process to end the program, that read, "Does anybody really want to throw out good, educated and accomplished young people who have jobs, some serving in the military? Really!....."

Trump on Tuesday continued negotiations with congressional leaders about a possible deal to revive the program's protections ahead of a March deadline, potentially in exchange for tighter border security. The Justice Department is likely to appeal Alsup’s decision.

Does anybody really want to throw out good, educated and accomplished young people who have jobs, some serving in the military? Really!.....

Justice Department spokesman Devin O'Malley said in an email to BuzzFeed that the department "will continue to vigorously defend this position, and looks forward to vindicating its position in further litigation."

"Today’s order doesn’t change the Department of Justice’s position on the facts: DACA was implemented unilaterally after Congress declined to extend these benefits to this same group of illegal aliens," O'Malley wrote. "As such, it was an unlawful circumvention of Congress, and was susceptible to the same legal challenges that effectively ended DAPA. The Department of Homeland Security therefore acted within its lawful authority in deciding to wind down DACA in an orderly manner. Promoting and enforcing the rule of law is vital to protecting a nation, its borders, and its citizens."

On Wednesday morning, White House Press Secretary Sarah Huckabee Sanders released a statement calling the decision "outrageous, especially in light of the President’s successful bipartisan meeting with House and Senate members at the White House on the same day."

"An issue of this magnitude must go through the normal legislative process. President Trump is committed to the rule of law, and will work with members of both parties to reach a permanent solution that corrects the unconstitutional actions taken by the last administration," Sanders said.

California Attorney General Xavier Becerra said in a statement that Alsup's order was a "huge step in the right direction."

"America is and has been home to Dreamers who courageously came forward, applied for DACA and did everything the federal government asked of them. They followed DACA’s rules, they succeeded in school, at work and in business, and they have contributed in building a better America. We will fight at every turn for their rights and opportunities so they may continue to contribute to America," Becerra said.

The administration announced in early September that it would end the program, which was established by President Obama in 2012. In a statement at the time, then-acting homeland security secretary Elaine Duke said, “The Department of Justice has carefully evaluated the program’s Constitutionality and determined it conflicts with our existing immigration laws.” Under what officials characterized as an "orderly wind-down," renewal applications received by Oct. 5 for DACA recipients whose benefits were set to expire by March 5 would still be processed, and the government would not terminate benefits for people already enrolled in the program before they were set to expire. But the administration would no longer process new applications, and wouldn't process renewal applications received after Oct. 5.

Alsup issued his ruling in five cases filed in California challenging the rescission. The plaintiffs included the University of California, several states, California municipalities, and individual DACA recipients.

The judge picked apart Attorney General Jeff Sessions' rationale for declaring that the DACA program was unlawful, finding that the rescission "was based on the flawed legal premise that the agency lacked authority to implement DACA." Alsup cited a 2014 memo issued by the Justice Department’s Office of Legal Counsel that explained that the Department of Homeland Security could exercise its discretion by granting deferred action to some immigrants who were unlawfully in the United States but considered a low priority for deportation.

"If each step is within the authority of the agency, then how can combining them in one program be outside its authority, so long as the agency vets each applicant and exercises its discretion on a case-by-case basis?" Alsup wrote.

He rejected the government's alternative argument that the Department of Homeland Security acted within its authority by managing its exposure to pending litigation filed by Republican state attorneys general challenging DACA. But Alsup wrote that the record showed that the rescission decision was rooted in Sessions’ finding that the program was unlawful, and the administration couldn't push an alternative explanation after the fact.

"Nowhere in the administrative record did the Attorney General or the agency consider whether defending the program in court would (or would not) be worth the litigation risk. The new spin by government counsel is a classic post hoc rationalization," Alsup wrote.

Even considering the litigation risk argument, Alsup found it lacking, writing that the record didn't show that Duke balanced any litigation risk against the interests of DACA recipients whose lives would be disrupted.

The judge concluded that the challengers were likely to suffer irreparable harm without immediate action from the court to partially continue the DACA program as the litigation went forward.

"Before DACA, Individual Plaintiffs, brought to America as children, faced a tough set of life and career choices turning on the comparative probabilities of being deported versus remaining here," he wrote. "DACA gave them a more tolerable set of choices, including joining the mainstream workforce. Now, absent an injunction, they will slide back to the pre-DACA era and associated hardship."

The judge noted that there wouldn't be a complete administrative record until after the March 5 deadline, which delayed the court's ability to issue a final judgment that could be appealed. The challengers were entitled to get a chance to look at the full record before the court took final action, the judge concluded.

"Plaintiffs are entitled to learn of all flaws, if any more there be, lurking in the whole record," he wrote. "One such possibility suggested by plaintiffs is that the rescission was contrived to give the administration a bargaining chip to demand funding for a border wall in exchange for reviving DACA. A presidential tweet after our hearing gives credence to this claim. Another possibility raised by plaintiffs is racial animus. These theories deserve the benefit of the full administrative record. It will be impossible to litigate this case to a fair and final conclusion before March 5."

The judge made clear that his order would not stop the government from deporting anyone, including DACA recipients, "who it determines poses a risk to national security or public safety, or otherwise deserves, in its judgment, to be removed."

Alsup also denied the government's motion to dismiss the lawsuits, rejecting arguments that the court lacked authority to review the Department of Homeland Security's decision.

This is a developing story. Check back for updates.