The Supreme Court appeared split along ideological lines Monday as justices took up one of the most significant challenges yet to President Obama’s use of executive power -- an election-year dispute over his bid to shield millions of undocumented immigrants from deportation and make them eligible to work in the U.S.

The justices’ questions and comments over the course of the 90-minute arguments left the possibility of a 4-4 tie -- which would represent a defeat for the Obama administration. A split decision also would set no guiding precedent on the use of presidential authority moving forward.

Still, comments by Chief Justice John Roberts helped keep a final decision in doubt, as he suggested a possible quick-fix in a key part of the policy. In doing so, he gave possible hope to the White House and its allies, even if a split decision still appears the most likely outcome.

"We believe at the end of the day, that even though there are only eight justices, there will be enough justices to uphold” the policies, said Sen. Robert Menendez, D-N.J., who is backing the White House. 

But Texas Attorney General Ken Paxton, who was also inside the court, warned, "If we allow a president … to make changes in the law without congressional approval, then we will end up with a perverted Constitution."

Texas is leading 26 states dominated by Republicans in challenging the programs Obama announced in 2014 and that have been put on hold by lower courts.

At issue is whether as many as 5 million illegal immigrants can be spared deportation -- including those who entered the U.S. as children, and the parents of citizens or legal residents. The programs -- known as Deferred Action for Parents of American Citizens and Permanent Residents (DAPA) and Deferred Action for Childhood Arrivals (DACA) -- effectively went around the Republican-led Congress. The  court is expected to decide by late June whether the efforts can move forward in the waning months of Obama's presidency, amid a presidential campaign marked by tough Republican rhetoric over immigration.

The justices on Monday were considering a fundamental question: how much power does the president truly have?

But the 90-minute public session dealt mostly with a more mundane question -- whether the states have legal authority, or "standing," to even bring their case.

Some liberal justices seemed to reject Texas' claim of great financial and sovereign harm by voluntarily using taxpayer dollars to subsidize drivers licenses given to undocumented workers.

"Those nearly 11 million unauthorized aliens are here in the shadows. They are affecting the economy whether we want to or not," said Justice Sonia Sotomayor. "The answer is, if Congress really wanted not to have an economic impact, it would ... allot the amount of money necessary to deport them, but it hasn't." 

But Justice Anthony Kennedy questioned Obama's authority. "That's the whole point, is that you've talked about discretion here. What we're doing is defining the limits of discretion. And it seems to me that that is a legislative, not an executive act," he said. "That seems to me to have it backwards. It's as if the president is setting the policy and the Congress is executing it. That's just upside-down."

Only Roberts among the conservative bloc seemed open to a compromise.

At issue was a two-word phrase in the Obama-issued policies -- "lawful presence" -- which opponents say gives undocumented aliens greater access to benefits than was intended by Congress.

Roberts and Justice Samuel Alito pointed out the confusion, wondering what the difference was between "lawfully present" and "legally present," which the Justice Department said were two separate things.

"How can it be lawful to work here but not lawful to be here?" asked Alito.

The chief justice -- who years ago helped preserve ObamaCare -- later said "crossing out" the "lawfully present" phrase might keep the executive action intact, a suggestion the Justice Department lawyer eagerly embraced, saying it would be "totally fine."

The coalition of states calls the presidents immigration actions an executive power grab. But the White House contends this authority is clear, and the policies humane and reasonable. Obama has promoted his program as a plan to "prioritize deporting felons not families."

A federal appeals court earlier had struck down DAPA, which has yet to go fully into effect. The Justice Department then asked the high court for a final review. The immigrants who would benefit from the Obama administration's plan are mainly parents of U.S. citizens and lawful permanent residents.

However, as with other high-profile Supreme Court appeals this term -- on ObamaCare, abortion rights and affirmative action -- the outcome here likely will be affected by the death in February of Justice Antonin Scalia, which left a 4-4 bench split along conservative-liberal lines.

A 4-4 ruling would effectively scuttle the issue until after Obama leaves office in nine months, and mean at least a temporary setback to his domestic policy legacy. The justices also could rule narrowly on procedure, finding a compromise on a technical issue not directly related to the larger policy questions.

On the legal side, the GOP-controlled House filed an amicus brief supporting the states, telling the high court, "the Executive does not have the power to authorize -- let alone facilitate -- the prospective violation of the immigration laws on a massive class-wide scale."

The case is U.S. v. Texas (15-674). 

The Associated Press contributed to this report.