A majority of the Supreme Court appeared ready Tuesday to uphold the Affordable Care Act’s essential components in the face of the latest challenge to the health care law brought by Republican-led states and the Trump administration.

Two key members of the court — Chief Justice John G. Roberts Jr. and Justice Brett M. Kavanaugh — said plainly during two hours of teleconferenced arguments that Congress’s decision in 2017 to zero-out the penalty for not buying health insurance did not indicate a desire to kill the entire law.

With that, the latest effort to derail President Barack Obama’s landmark domestic achievement seemed likely to meet the fate of past endeavors. President Trump and Republicans have never summoned the votes to repeal the measure — even when in control of Congress and the White House. And the court has been unwilling to do the work for them.

Roberts, a conservative who nonetheless became the bane of many on the right when he wrote the 2012 Supreme Court decision upholding the act’s constitutionality, alluded to that in Tuesday’s arguments.

“I think it’s hard for you to argue that Congress intended the entire act to fall … when the same Congress that lowered the penalty to zero did not even try to repeal the rest of the act,” Roberts told Kyle D. Hawkins, the Texas solicitor general marshaling the effort on behalf of 18 Republican-led states.

“I think, frankly, that they wanted the court to do that. But that’s not our job,” he said.

Trump has said either a repeal of the law or the court’s nullification was necessary for a new health-care plan to proceed, but he never offered a proposal. President-elect Joe Biden made it clear in a speech Tuesday that he intends to build upon the program.

“These ideologues are once again trying to strip health coverage away from millions of people,” Biden said, referring to Republican lawmakers.

But he said, “We’re going to build a health-care system that puts you and your families first and that every American can be proud of.”

For challengers, the middle of a pandemic was an inopportune time to bring the case. The court battle gave Democrats an issue to press during the campaign, and a decision that would eliminate all of the law’s popular provisions — such as covering people’s existing medical conditions or providing subsidies for purchasing health insurance — would threaten millions of Americans.

The case came before a court whose conservative leanings were strengthened by Trump’s nominees — Kavanaugh and Justices Neil M. Gorsuch and Amy Coney Barrett.

But Kavanaugh was not coy. He said several times that the court’s precedents — presumably including an opinion he wrote last term — created a strong presumption that a law should be saved if the constitutional infirmity can be easily excised.

“It does seem fairly clear that the proper remedy would be to sever the mandate provision and leave the rest of the act in place,” Kavanaugh told Hawkins.

The court’s three liberals have all supported the ACA in the past and gave no reason to think they were wavering about whether it should remain in place.

Justice Elena Kagan, an Obama appointee, said it was strange to bring a lawsuit after Congress had gotten rid of the penalty for noncompliance. “Congress made the law less coercive,” she said, wondering how that could turn it into “an unconstitutional command.”

Roberts, Kavanaugh and the liberals would make a majority of five to save the law, whatever the findings on the other aspects of the suit.

Gorsuch was harder to read, and so was Barrett. At her confirmation hearing just weeks ago, Democrats attempted to make the case for opposing Barrett by saying she was likely to rule against the ACA.

As a law professor before she became a judge, Barrett criticized the court’s two previous decisions upholding the law. She wrote in a law review article that Roberts had “pushed the Affordable Care Act beyond its plausible meaning to save the statute.”

Roberts joined the court’s conservatives in saying that the commerce clause of the Constitution did not give Congress the authority to require Americans to purchase health insurance. But the chief justice and the court’s liberals said that the penalty for not buying insurance could be considered a tax and that the law thus was constitutional under Congress’s taxing power.

Barrett sounded skeptical that Congress could reduce the penalty to zero and still have it construed as a tax. But she did not ask questions or show her hand about whether she believed the rest of the law could stand even if that were the case.

Washington lawyer Donald B. Verrilli Jr., who as Obama’s solicitor general had defended Obamacare previously, argued this time on behalf of the House of Representatives and said it should be clear Congress intended for the law to continue without the individual mandate.

In the past decade, health insurance markets have been reshaped, and millions of Americans depend on the ACA and the benefits it provides.

“To assume that Congress put all of that at risk when it amended the law in 2017 is to attribute to Congress a recklessness that is both without foundation in reality and jurisprudentially inappropriate,” Verrilli said.

“In view of all that has transpired in the past decade, the litigation before this court, the battles in Congress, the profound changes in our health-care system, only an extraordinarily compelling reason could justify judicial invalidation of this law at this late date,” he said.

Acting solicitor general Jeffrey B. Wall, representing the Trump administration, said the court should follow what Congress did, not “what it may have intended to do.”

“When Congress eliminated the [mandate], it left standing what is now a naked command to obtain insurance,” Wall said — something the court in 2012 said Congress did not have the power to do. It said it “left standing the findings that that mandate is essential to the operation of other parts of the act.”

Tuesday’s case posed three questions: Do the challengers have legal standing to bring the case? Did changes made by Congress in 2017 render unconstitutional the ACA’s requirement for individuals to buy insurance? And if so, can the rest of the law be separated out, or must it fall in its entirety?

The justices spent a lot of time debating whether the individuals or the states were really harmed by a mandate that no longer carries a penalty.

Wouldn’t Americans feel they had to comply with the law, no matter whether there is a penalty, some justices asked. Their hypotheticals included a congressional finding requiring the display of an American flag outside a household, or a weekly lawn-mowing requirement.

Justice Clarence Thomas asked about masks.

“I assume that in most places there is no penalty for wearing a face mask or a mask during covid, but there is some degree of opprobrium if one does not wear it in certain settings,” he said, referring to the disease caused by the novel coronavirus whose relentless spread has fueled the pandemic. But if there is no penalty, “Would they have standing to challenge the mandate to wear a mask?”

California Solicitor General Michael J. Mongan, representing the Democratic-led states supporting the law, said it was possible. But the penalty-less mandate in this case, he said, “is entirely toothless.”

He said it would be “deeply problematic” for the states and the nation if plaintiffs “were allowed to leverage this single inoperative provision to tear down hundreds of other provisions” that Congress left in place.

Hawkins disagreed. “The mandate as it exists today is unconstitutional. It is a naked command to purchase health insurance, and as such it falls outside Congress’s enumerated powers.” Because the mandate is essential to the law, he continued, “the mandate is inseparable from the remainder of the law.”

Justice Stephen G. Breyer said the U.S. Code must be filled with instances in which Americans are told they “shall” do something, but there is no penalty.

“Have you ever heard that or used ‘shall’ in respect to a supplication or an entreaty?” Breyer asked Wall.

“No, Justice Breyer. In my family, when I tell my kids that they shall do things, they’re — that’s a command backed by a penalty,” Wall said.

“Well, that’s a much more organized family than mine,” Breyer replied.

Roberts reminded Verrilli that eight years ago, he and the law’s defenders said the mandate was crucial to the law.

“But now the representation is that, ‘Oh no, everything is fine without it.’ Why the bait and switch?” Roberts asked.

Verrilli said the mandate was crucial at the time to create new insurance markets, with subsidies as “carrots” and the requirement to either purchase insurance or pay a penalty a “stick.”

“It’s turned out that the carrots work without the stick,” he said.

Roberts remembered the 2012 debate about a different vegetable, and whether Congress’s ability to force consumers to buy insurance could also force them to purchase healthier food.

“We spent all that time talking about broccoli for nothing?” Roberts asked.

The case is California v. Texas. A decision is likely to take months.

Paulina Firozi and Erica Werner contributed to this report.