Washington CNN  — 

The Supreme Court on Thursday blocked the Trump administration’s attempt to end Deferred Action for Childhood Arrivals, an Obama-era program that protects hundreds of thousands of immigrants brought to the US as children from deportation.

The 5-4 ruling was written by Chief Justice John Roberts and joined by Justices Ruth Bader Ginsburg, Elena Kagan, Stephen Breyer and Sonia Sotomayor.

In penning the opinion, Roberts once again sided with the liberals on the bench in a momentous dispute that will infuriate judicial conservatives who are still bitter that he once provided the deciding vote to uphold Obamacare.

The opinion is the second time in a week when the Supreme Court – bolstered with two of President Donald Trump’s nominees – has ruled against the Trump administration. Monday, the court said LGBTQ Americans are protected under the Civil Rights Act.

The ruling emphasizes that the administration failed to provide an adequate reason to justify ending the DACA program.

“We do not decide whether DACA or its rescission are sound policies,” Roberts wrote in the majority opinion. “‘The wisdom’ of those decisions ‘is none of our concern.’ We address only whether the agency complied with the procedural requirement that it provide a reasoned explanation for its action.”

It is a blow to the Trump administration, as immigration reform has been a lynchpin of Trump’s agenda. It means that for now, participants in the program can continue to renew membership in the program that offers them work authorization and temporary protection from deportation.

President Donald Trump appeared to blast the DACA decision and an opinion issued earlier this week that extended anti-discrimination protections to LGBTQ workers.

“These horrible & politically charged decisions coming out of the Supreme Court are shotgun blasts into the face of people that are proud to call themselves Republicans or Conservatives,” he tweeted.

Trump continued to attack the decision in a series of tweets later Thursday, claiming it didn’t seem to be “based on the law” and that it “tell you only one thing, we need NEW JUSTICES of the Supreme Court.”

Former President Barack Obama also weighed in on the decision on Twitter Thursday morning, writing of DACA recipients: “Today, I’m happy for them, their families, and all of us.”

“We may look different and come from everywhere, but what makes us American are our shared ideals,” Obama wrote, noting the program was created eight years ago this week.

Presumptive Democratic presidential nominee Joe Biden also celebrated the ruling, calling it a “victory” and again saying that if elected, he will work “immediately” on legislation that would make the program “permanent.”

“The joy of today’s victory does not erase the difficult road ahead,” Biden said in a statement. “We know that much work remains to be done.”

And California Attorney General Xavier Becerra, who led a coalition of attorneys general in defense of DACA before the Supreme Court last year, told CNN Thursday evening the ruling was “an indictment of the way the Trump administration does business.”

“It said that everyone must follow the rule of law,” he told CNN’s Erin Burnett of the ruling. “The White House and the occupant don’t have a right to be above the law.”

RELATED: DACA by the numbers

The Trump administration could move, again, to try to rescind the program, but this time the administration will have to provide a better explanation grounded in policy for its reason for termination.

“Today’s decision allows Dreamers to breathe a temporary sigh of relief,” said Professor Stephen Yale-Loehr of Cornell Law School. “The administration may try to terminate the DACA program with a better justification, but that will take months or years. In the meantime, Congress should enact permanent relief for Dreamers to end this drama once and for all.”

Luz Chavez, a DACA recipient based in Maryland, was at the steps of the Supreme Court when the decision came down Thursday.

“Right now, at the end of the day, our community won, right? We’ve been pushing for this for a long time. Immigrant youth are the reason why DACA was announced and created,” Chavez told CNN. “It’s exhilarating.”

‘A delicate political issue’

After the ruling was handed down on Thursday, Trump retweeted a tweet featuring Justice Clarence Thomas’ dissent.

The decision is “an effort to avoid a politically controversial but legally correct decision,” Thomas wrote.

Thomas, one of the court’s most conservative members, argued in his dissent that “the majority makes the mystifying determination that this rescission of DACA was unlawful. In reaching that conclusion, the majority acts as though it is engaging in the routine application of standard principles of administrative law.”

“On the contrary, this is anything but a standard administrative law case.”

Justice Samuel Alito seemed to agree with Thomas’ assessment, writing that “DACA presents a delicate political issue, but that is not our business.”

“As Justice Thomas explains, DACA was unlawful from the start, and that alone is sufficient to justify its termination. But even if DACA were lawful, we would still have no basis for overturning its rescission,” Alito argued.

And Justice Brett Kavanaugh, Trump’s second nominee to the court, wrote a separate dissent praising immigrants, but saying he did not agree with the majority opinion.

“They live, go to school, and work here with uncertainty about their futures. Despite many attempts over the last two decades, Congress has not yet enacted legislation to afford legal status to those immigrants,” Kavanaugh wrote.

He noted that that “the only practical consequence of the Court’s decision to remand appears to be some delay” because the court’s decision “seems to allow the Department on remand to relabel and reiterate substance.”

Created by Obama after congressional stalemate

DACA, established in 2012, is available to any undocumented immigrant who came to the US under the age of 16, who had lived in the US since at least June of 2007, was enrolled in high school or graduated and had not been convicted of certain offenses.

An individual also had to pose no national security or public safety threats. Recipients who met the criteria became eligible for renewable, two-year grants of “deferred action” from removal. They were also eligible for work authorization and Social Security numbers. In return, however, they had to provide the government with certain identifying information.

After Trump came into office, then-Attorney General Jeff Sessions announced the program had been created “without proper authority” and only after Congress had rejected proposed legislation. The following day, Elaine Duke, then-acting Secretary of Homeland Security, announced it would be phased out, pointing out that it had “legal and constitutional defects.”

Months later, after legal challenges had been launched, then-Homeland Security Secretary Kirstjen Nielsen issued a new memo laying out more policy-based justifications for winding down the program. She said, for example, that the program increased the risk of undermining public confidence in the rule of law.

Federal courts stepped in and said the administration had acted arbitrarily when phasing out the program in violation of the law. The courts pointed to the administration’s thin justification – reasoning Roberts and the Supreme Court eventually agreed with.

The administration moved aggressively asking the Supreme Court to lift the injunctions, and the President predicted success.

“We want to be in the Supreme Court on DACA,” Trump said. But the justices sat on the petition for months, before finally granting cert last term.

The plaintiffs, including the University of California, a handful of states and DACA recipients argue to the Supreme Court that the phase-out violated the Administrative Procedure Act, a federal law that governs how agencies can establish regulations.

One hundred and forty-three business associations and companies filed a brief in support of DACA stressing that its phase-out will harm the economy. The brief points to research from the libertarian Cato Institute that estimates that companies will face an estimated $6.3 billion in costs to replace Dreamers “if they can even find new employees to fill the empty positions.”

And Tim Cook, the CEO of Apple, filed a brief in support of DACA noting that his company employs 443 Dreamers who come from 25 different countries and four continents.

“We did not hire them out of kindness or charity,” Cook argued. “We did it because Dreamers embody Apple’s innovative strategy” he said. “They come from diverse backgrounds and display a wide range of skills and experiences that equip them to tackle problems from different perspectives.”

After the justices heard arguments in the case, supporters of DACA recipients also told the court that some 27,000 recipients were working on the front lines to fight Covid-19.

Lawmakers look for a more permanent solution

Several Democratic lawmakers applauded the decision by the court, proclaiming it a victory while also pushing for more permanent protections for Dreamers.

House Speaker Nancy Pelosi praised the decision in a press conference Thursday, saying it “supports our values as a country.”

Senate Minority Leader Chuck Schumer called it a “wonderful, wonderful day for the DACA kids, for their families and for the American dream.”

“We’ve always believed in immigration in America. We’ve had some dark forces oppose it in recent years, but we believe in it. It’s part of our soul,” the New York Democrat said on the Senate floor. “In these very difficult times, the Supreme Court provided a bright ray of sunshine this week.”

Many lawmakers pointed to the Dream and Promise Act, a bill making its way through the Senate that prohibits removal proceedings against certain immigrants and provides them with a path to permanent resident status, as a next step in the fight for DACA.

“Supreme Court decision on #DACA is a victory for Dreamers & the American people against the cruelty & unlawfulness of the Trump admin,” Democratic Rep. Joaquin Castro of Texas tweeted. “Senate must immediately pass American Dream & Promise Act for permanent protection.”

Sen. Elizabeth Warren called upon Senate Republicans to “stop political games” on the bill.

“I’m happy the Supreme Court upheld DACA to protect Dreamers from the crisis Trump created. But we can’t stop here,” the Massachusetts Democrat tweeted. “(Senate GOP): stop the political games & pass this bill for Dreamers & their families.”

Former members of the Obama administration echoed those calls.

David Axelrod, a former Obama senior adviser and CNN commentator, tweeted Thursday that action from Congress is needed.

“DACA was never presented as a permanent solution for these young people or to the status of the millions of undocumented people who are here, contributing to, and embedded in, our communities, yet still in a legal shadow. Congress needs to act to address these issues,” Axelrod said.

Former Democratic presidential nominee and member of the Obama administration Hillary Clinton also weighed in, urging Congress to provide a path to citizenship for DACA recipients.

“Today’s Supreme Court decision to uphold DACA is a happy end to the cruel uncertainty the Trump administration put these young people through. Now Congress must give them a path to citizenship,” she said.

GOP criticism of Roberts

Rep. Jim Jordan, the top Republican on the House Judiciary Committee, took aim at Roberts for once again siding with the liberal justices.

“First, Obamacare. Now, DACA. What’s next? Our second amendment gun rights?” Jordan, who represents Ohio, wrote in a tweet.

Sen. Tom Cotton was just as unhappy with the chief justice.

“Yet John Roberts again postures as a Solomon who will save our institutions from political controversy and accountability,” the Arkansas Republican said. “If the Chief Justice believes his political judgment is so exquisite, I invite him to resign, travel to Iowa, and get elected. I suspect voters will find his strange views no more compelling than do the principled justices on the Court.”

This story has been updated with details of the ruling and reaction.

CNN’s Priscilla Alvarez contributed to this report.