A closely divided Supreme Court on Tuesday grappled with whether to allow the Trump administration to bring an end to the Deferred Action for Childhood Arrivals program.

After more than an hour of arguments, the court’s conservative wing of the bench appeared ready to side with President Trump in his efforts to rescind the program, which was started under President Barack Obama in 2012 and provides legal protections for young immigrants.

The dispute is one of the most closely watched of the Supreme Court’s blockbuster term, and hanging in the balance is the fate of 700,000 Dreamers, the name given to those brought to the United States illegally as children and shielded from the threat of deportation. A decision by the court is expected by the end of June, in the heart of the 2020 presidential campaign.

A central question in the trio of cases before the court is whether the Trump administration’s rescission of DACA can even be reviewed by the courts.

Justices Samuel Alito and Neil Gorsuch raised questions as to whether the courts should do so, with Gorsuch saying he was “still struggling” with whether the executive branch's decision should be reviewed.

A coalition of states, civil rights organization, and Dreamers challenged Trump’s attempt to shut down DACA and argue the explanation for doing so — detailed in memos written by former acting Homeland Security Secretary Elaine Duke and former Secretary Kirstjen Nielsen — rests on a faulty legal premise.

When then-Attorney General Jeff Sessions announced in September 2017 the Trump administration would roll back DACA, he said its justification for doing so was based on the assessment the program violated the law.

But Chief Justice John Roberts suggested the rationale outlined in Nielsen’s memo and by Sessions was sufficient, citing a lower court ruling blocking a similar program implemented by Obama.

"Is it enough for [the attorney general] to say, 'Look, I've got a decision from the 5th Circuit that tells me this is illegal, it's been affirmed by the Supreme Court by an equally divided vote? That's enough for me to say we're not going to do it?'" Roberts asked Michael Mongan, who argued on behalf of a group of states.

Justice Brett Kavanaugh, like Roberts, suggested Nielsen's reasoning was enough.

"I mean, this is a serious decision. We all agree with that. And it was for the secretary, presumably," he said. "And to say in writing even if it's lawful, I nonetheless am going to exercise my discretion, I assume that was a very considered decision."

But Justice Ruth Bader Ginsburg rejected Nielsen's justification, saying the whole document is “infected by the idea that" DACA is illegal.

If the notion of the program's unlawfulness was removed, "then she would be saying we stand up and say this is the policy of our administration. We don't like DACA, and we're taking responsibility for that, instead of trying to put the blame on the law," Ginsburg added.

Firmly on the side of Dreamers and states challenging DACA’s end was Justice Sonia Sotomayor, who said she has “always had some difficulty” in understanding DACA's illegality.

Sotomayor noted comments from Trump in which he reassured DACA recipients, "they were safe under him and that he would find a way to keep them here."

“He hasn’t, and instead, he's done this," she said. "And that, I think, has something to be considered before you rescind a policy. Not just say I'll give you six months to do it, to destroy your lives."

DACA recipients have a broad coalition of support in their efforts to invalidate Trump’s rollback of the Obama-era program, with universities, civil rights groups, and more than 140 businesses urging the Supreme Court to reject the president’s bid.

Dreamers, a coalition of top companies, and business associations wrote in a friend-of-the-court brief last month, are valuable employees, and rescinding the program would “inflict serious harm on U.S. companies, all workers, and the American economy as a whole.”

Justice Stephen Breyer questioned whether the Trump administration took into account the effects DACA’s unwinding would have on employers, universities, and the broader U.S. economy, which are "not quite the same as those of the 700,000 who have never seen any other country."

But Solicitor General Noel Francisco, who argued for the Trump administration, said Nielsen’s memo took into account the range of impacts of DACA’s end and argued its unwinding was a matter of both law and policy.

"We own this," he said.

The Trump administration has tied DACA’s presumed unlawfulness to litigation over the Deferred Action for Parents of Americans and Lawful Permanent Residents policy, a similar program that was blocked by the 5th U.S. Circuit Court of Appeals. The Supreme Court deadlocked 4-4 on that program’s legality, leaving the lower court ruling in place.

After Sessions announced DACA’s end, the Trump administration imposed a five-month deadline for Congress to codify the program's legal protections. But efforts by lawmakers to reach an agreement on immigration reform — which would include a solution for Dreamers — have failed.

Still, the program remains intact, as the administration has been blocked by the lower courts from moving forward with its plan to end the program, as judges have rejected its rationale for doing so.

“To be clear: we do not hold that DACA could not be rescinded as an exercise of Executive branch discretion,” Judge Kim McLane Wardlaw wrote for the three-judge panel on the 9th U.S. Circuit Court of Appeals. “We hold only that here, where the executive did not make a discretionary choice to end DACA — but rather acted based on an erroneous view of what the law required — the rescission was arbitrary and capricious under settled law.”

Since Obama implemented deferred action in 2012, more than 825,000 immigrants have benefited from the program, according to one estimate.

Trump’s effort to end the program is part of his broader agenda to crack down on illegal immigration into the U.S. The president largely blamed Democrats for failing to reach an agreement on a permanent fix for Dreamers, though he tied any action on DACA to funding for a border wall.

But Trump asserted Tuesday that if the Supreme Court allows the administration to end DACA, “a deal will be made with Dems for [Dreamers] to stay.”