President Trump on Friday said that the Obama-era executive order granting protections to some immigrants who came to the country as minors was a “totally illegal document” that former President Obama never had the right to sign.

“President Obama never had the legal right to sign DACA, and he indicated so at the time of signing. But In any event, how can he have the right to sign and I don’t have the right to 'unsigned.' Totally illegal document which would actually give the President new powers,” he tweeted, after quoting analysis from Immigration Law Institute's Christopher Hajec calling the program "unlawful."

SUPREME COURT TO DECIDE WHETHER TRUMP ADMINISTRATION CAN END DACA PROGRAM

The Deferred Action for Childhood Arrivals (DACA) program was signed by Obama via executive order in 2012 and gave more than 700,000 immigrants that activists call “Dreamers” a renewable two-year reprieve from deportation and the ability to gain a work permit.

“DACA will be going before the Supreme Court. It is a document that even President Obama didn’t feel he had the legal right to sign - he signed it anyway!” Trump tweeted.

Trump, who campaigned on repealing DACA in 2016, announced a plan in 2017 to phase out the program, but was blocked by federal courts that ruled that the phase-out could not apply retroactively and that the program should be restarted. The White House fought back on those decisions, saying the president has broad authority over immigration enforcement policy.

DACA proponents have also argued that Trump’s planned termination of the program violates federal law requiring adequate notice-and-comment periods before certain federal rules are changed, as well as other constitutional equal protection and due process guarantees.

The case is now headed to the Supreme Court, where justices will begin hearing oral arguments in October. A ruling will likely come in 2020 and could galvanize activists on both sides of the political spectrum in the middle of an election year.

The Justice Department submitted a brief to the court last month saying that Trump acted lawfully when he ended the program

PRESIDENT TRUMP DECISION TO END DACA WAS LAWFUL, JUSTICE DEPARTMENT SAYS

CLICK HERE TO GET THE FOX NEWS APP

However, on Friday Trump also renewed his calls for Congress to pass an immigration deal that includes a DACA fix, something the White House has expressed openness to before.

“Rest assured that if the SC does what all say it must, based on the law, a bipartisan deal will be made to the benefit of all!"

Fox News' Shannon Bream and William Mears contributed to this report.