WASHINGTON — For the first time in nearly a decade, Republicans are heading into a national election divided and defensive over health care, the very issue that once propelled them to majorities in the House and Senate.

After failing to deliver on their yearslong promise to repeal the Affordable Care Act and faced with the sudden popularity of Obamacare’s consumer protections, Republican candidates across the country are struggling to put together a cohesive message on health care.

Die-hards still want to repeal the 2010 law, but a growing number of Republicans – particularly those facing tough elections – want to quietly admit defeat and move on to other issues.

“Even to bring it up is picking at the scab,” said Joe Antos, a health policy expert at the American Enterprise Institute, a conservative think tank. “It’s reminding people that they (failed). The base isn’t that stupid.”

Other Republican candidates find themselves trying to thread an awkward needle of opposing Obamacare – a law that is still unpopular with base voters – while supporting some of its key provisions. A few Republicans who once called for the repeal of Obamacare are now even embracing it, albeit cautiously.

Rep. David Joyce, R-Ohio, who is seeking re-election in a district that leans Republican, is running ads boasting that he opposed his party’s attempt to eliminate protections for people with pre-existing conditions.

But between 2013 and 2016, Joyce cast dozens of votes to repeal or undermine the health law. Back then, when President Barack Obama was able to veto repeal efforts, Republicans like Joyce were able to vote against Obamacare with no threat of their constituents losing coverage. After Donald Trump was elected and Republicans tried to repeal the law, Joyce changed his position.

Republican candidates for governor in Ohio and Nevada, both once-harsh critics of Obamacare, now say they won’t – if elected – undo previous decisions to expand Medicaid in their states through the 2010 law.

Rich Cordray, the Democratic candidate for Ohio governor, has tried to make health care a key issue in his bid against Republican Mike DeWine, the state’s attorney general, accusing DeWine of trying to end the Medicaid expansion and eliminate coverage for 700,000 Ohioans.

But even as DeWine assures voters he won’t undo expansion, he also tried to put a conservative stamp on it by promising reforms. Echoing other Republican governor hopefuls, DeWine wants to consider adding work requirements to Medicaid – an idea the Trump administration has backed but which is being challenged in court.

Republican state attorneys general Patrick Morrisey of West Virginia and Josh Hawley of Missouri joined a multistate, Republican-backed lawsuit that seeks to end a requirement in the 2010 law that all Americans have insurance. It was a move that helped buoy their conservative bona fides.

But now as they run for the U.S. Senate, they have had to distance themselves somewhat from the effort, particularly after the Trump administration adopted the legal position that not only should the individual mandate go, but pre-existing conditions protections should too. The pre-existing-conditions provision is by far the most popular under Obamacare. So both Republican candidates now say they support requiring insurance companies to cover people with preexisting conditions, even as they remain part of the repeal lawsuit.

It’s a starkly different climate from just two years ago, when Republican candidates could count on opposition to Obamacare as a guaranteed applause line on the stump. Once repeal became a political possibility, the Affordable Care Act – particularly a few individual pieces – became more popular.

Forty-eight percent of adults have favorable opinions of the law while 40 percent have unfavorable views, according to a nonpartisan Kaiser Family Foundation poll. In April 2016, those were flipped: 49 percent of adults with unfavorable opinions and 38 percent favorable.

Some Republicans are still eager to keep trying to repeal or dismantle the law.

Sen. Ted Cruz, R-Texas, who is facing a surprisingly strong challenge from underdog Texas Democratic Rep. Beto O’Rouke, wants Republicans to try Obamacare repeal again. Earlier this month, he went to the Senate floor to try to block the District of Columbia from requiring people to have health insurance – a requirement similar to the Obamacare rule Republicans repealed across the country earlier this year.

The Republican candidate for governor in Maine has pledged to continue incumbent Gov. Paul LePage’s die-hard opposition to expanding Medicaid under Obamacare – an expansion that 59 percent of Maine voters approved in a ballot measure last year.