People wait in line outside the Supreme Court on Monday to be able to attend oral arguments. | Susan Walsh/AP Photo

The Supreme Court is set to wrestle Tuesday with one of the most momentous issues to reach the justices in years: whether to allow the Trump administration to shut down a program that gives work permits and quasi-legal status to about 660,000 foreigners who entered the U.S. illegally as children.

After winning election to the White House in large part by promising a crackdown on illegal immigration, President Donald Trump moved to end the Deferred Action for Childhood Arrivals — DACA — initiative that President Barack Obama created through executive action in 2012.

However, courts blocked Trump’s effort to wind down the program, finding that the administration’s process for reversing the earlier decision was legally flawed.

The long-term U.S. residents who benefit from DACA — so-called Dreamers — have rallied to preserve the program, arguing that they typically had no role in their parents’ decision to bring them to the country and are now essentially Americans in nearly all ways, except for their legal status.

The Dreamers, many of them high school and college students, have gotten a sympathetic reception even from some harsh opponents of illegal immigration, but legislation to address their plight has been bogged down for more than a decade.

The question going before the Supreme Court Tuesday is not strictly speaking about whether the Obama administration acted legally when it set up the program in 2012, but is instead over how the Trump administration attempted to dismantle it.

In 2016, the high court heard a challenge to DACA brought by conservative states, but the court, shorthanded due to the unexpected death of Justice Antonin Scalia, deadlocked, leaving the program in place.

Chief Justice John Roberts appears to have aligned with his fellow conservatives in that fight, but is widely viewed as the most likely swing vote in the current dispute. In June, he surprised many legal observers by siding with the court’s four Democratic appointees to reject the Trump administration’s attempt to add a question about citizenship to the 2020 census.

Roberts did not dispute the administration’s authority to change the census forms, but concluded that the official explanation the administration gave for the additional question was “contrived” — in essence, a sham.

The current legal battle over DACA involves a similar claim that the rationale the Trump administration offered for ending the program — a new lawsuit that conservative states were threatening but never filed — is too flimsy to justify the decision.

Justice Department lawyers defending the decision have argued that there is no legal basis for the courts to review an Executive Branch decision to drop a program like DACA that was itself set up through executive action by a prior administration.

The Trump administration also contends that concerns about future litigation against DACA were a sufficient basis for the move then-Attorney General Jeff Sessions announced in September 2017 to wind down the program by stopping renewal of the two-year-long work permits issued to recipients.

Trump has decried the court rulings blocking the decision to rescind DACA and has argued that they halted the political momentum to pass legislation that could have offered so-called Dreamers long-term residency in the U.S.

The president echoed that stance in a tweet Tuesday that simultaneously painted DACA recipients as dangerous and promised to work out a way for Dreamers to remain in the U.S. even if his decision to end the program is upheld.

“Many of the people in DACA, no longer very young, are far from ‘angels,’” Trump wrote. “Some are very tough, hardened criminals. President Obama said he had no legal right to sign order, but would anyway. If Supreme Court remedies with overturn, a deal will be made with Dems for them to stay!”

Foreigners with a felony conviction or extensive misdemeanor records are ineligible for DACA and can be removed from the program if they commit crimes after obtaining DACA status. Official statistics show 850 DACA recipients had their status “terminated” due to criminal or gang activity in fiscal year 2017.

Democrats contend that a legislative deal faltered early last year not because of the court decisions, but because conservative lawmakers and talk-show hosts pilloried the proposed compromise, prompting Trump to back away from the outlines of a package he had previously agreed to.

The justices may well have observed the political tussle and preferred the fight over the Dreamers to be resolved that way. The Trump administration first asked the high court to weigh in back in January 2018, after the first rulings against the DACA wind-down, but the justices declined. They said they would follow the customary course of awaiting a decision from one or more appeals courts before deciding whether to take up the issue.

The Justice Department brought the dispute back to the court a year ago, but the justices displayed their reluctance to get involved by sitting on those petitions for almost a full term, before finally agreeing in June to take up the matter this fall.

The sluggishness by the justices gave Trump and Democrats more time to work out a legislative compromise, but with those efforts apparently dead, the delay means a potentially politically explosive decision by the high court is likely next spring or as late as the end of June— just as Trump’s reelection bid is ramping up.

The cases going before the court were filed by DACA recipients, four liberal states, local governments and the University of California, all of whom said they would be harmed by the Trump administration’s move to end the program.

Ted Olson, a former solicitor general under President George W. Bush, is arguing for the DACA recipients. He’s expected to be flanked at the counsel table by an attorney who is himself a so-called Dreamer, Luis Cortes. The 31-year-old graduate of the University of Idaho law school was born in Mexico and came to California at the age of 1 with his parents, who were seeking work.

The states and other local governments fighting Trump’s decision are represented by California Solicitor General Michael Mongan.

Solicitor General of the U.S. Noel Francisco is set to defend the administration’s move to end the program.