WASHINGTON – Conservative Supreme Court justices expressed sharp skepticism about President Obama’s immigration efforts Monday, leaving his actions to help millions of people who are in the country illegally in the hands of a seemingly divided court.

As hundreds of pro-immigration demonstrators and a smaller number of opponents filled the sidewalk outside the court, the justices appeared to split along ideological and partisan lines over a case that pits Republican governors and members of Congress against the Democratic administration.

Obama’s administration is asking the justices to allow it to put in place two programs that could shield roughly 4 million people from deportation and make them eligible to work in the United States.

Texas is leading 26 states led by Republicans in challenging the programs that Obama announced in 2014 and that have been put on hold by lower courts. Those states say the administration usurped power that belongs to Congress, and Kennedy indicated some support for that view.

“It’s as if … the president is setting the policy and the Congress is executing it. That’s just upside down,” Kennedy said.

Roberts also aggressively questioned Solicitor General Donald Verrilli Jr., suggesting there are few limits to the president’s power under the administration’s view of immigration law.

“Under your argument, could the president grant deferred removal to every … unlawfully present alien in the United States right now?” Roberts asked.

“Definitely not,” Verrilli said. But it was not clear that Roberts was satisfied with the answer and subsequent explanation.

The programs would apply to parents of children who are citizens or are living in the country legally. Eligibility also would be expanded for the president’s 2012 effort that applies to people who were brought here illegally as children. More than 700,000 people have taken advantage of that earlier program, Deferred Action for Childhood Arrivals. The new program for parents, known as Deferred Action for Parents of Americans, and the expanded program for children could reach as many as 4 million people, according to the nonpartisan Migration Policy Institute.

If the court is split ideologically, the case could end in a 4-4 tie following Justice Antonin Scalia’s death in February. That would leave the programs in limbo, almost certainly through the end of Obama’s presidency.

Both sides acknowledge that the outcome of the presidential election ultimately could determine the programs’ fates, even if the Supreme Court rules for the administration. Republican candidates have pledged to roll back Obama’s actions, and Republican candidate Donald Trump has proposed deporting the roughly 11 million people who are living in the U.S. illegally. Justices remarked how Congress provides enough money to deport only about 400,000 people annually.