The United States Supreme Court on Thursday blocked President Donald Trump’s attempt to end protection from deportation to lakhs of undocumented immigrants, also known as Dreamers, who arrived in the country as children, Reuters reported.

The country’s top court upheld lower courts’ decision that said Trump’s move to scrap the Deferred Action for Childhood Arrivals programme in 2017 was unlawful. The programme was launched in 2012 by Trump’s predecessor Barack Obama.

The courts had also found that the Trump administration’s order violated the Administrative Procedure Act, under which the government cannot make policy that is “arbitrary, capricious, an abuse of discretion or otherwise not in accordance with law” or “unsupported by substantial evidence”. Judges of the US Supreme Court voted 5-4 to uphold the findings. Conservative Chief Justice John Roberts joined the court’s four liberals.

For the over 6 lakh immigrants, mostly from Latin American countries, the court’s ruling would ensure that they are not deported and are eligible to apply for renewable two-year work permits to stay in the country.

Trump raged over the top court’s ruling on Twitter. “These horrible and 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 wrote. “We need more Justices or we will lose our Second Amendment and everything else. Vote Trump 2020!”

“As President of the United States, I am asking for a legal solution on DACA, not a political one, consistent with the rule of law,” he added. “The Supreme Court is not willing to give us one, so now we have to start this process all over again.”

Obama, on the other hand, praised the top court’s verdict. “Eight years ago this week, we protected young people who were raised as part of our American family from deportation”, he tweeted. “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.”