Leaning back on a black leather sofa as her campaign bus rumbled toward Fort Dodge, Kamala D. Harris tried to explain why she spent months defending a plan to replace private health insurance with Medicare-for-all, only to switch to a more modest proposal that would allow private insurance to continue after all.

“I don’t think it was any secret that I was not entirely comfortable — that’s an understatement,” Harris said, holding a to-go cup from a Mexican restaurant at a recent stop. “I finally was like, ‘I can’t make this circle fit into a square.’ I said: ‘We’re going to take hits. People are going to say she’s waffling. It’s going to be awful.’ ” But, she said, she decided it was worth it.

The Democratic senator from California is hardly alone. The idea of Medicare-for-all — a unified government health program that would take over the basic function of private insurance — became a liberal litmus test at the outset of the presidential campaign, distinguishing Democratic contenders who cast themselves as bold visionaries from more moderate pragmatists.

But in recent months, amid polling that shows concern among voters about ending private insurance, several of the Democratic hopefuls have shifted their positions or their tone, moderating full-throated endorsement of Medicare-for-all and adopting ideas for allowing private insurance in some form.

“What I think has happened in the Democratic primary is people recognize that some of the concerns about single-payer are not coming from special interests but the public,” said Neera Tanden, a former top aide to Hillary Clinton and now president of the Center for American Progress. (A government-run health system is sometimes called a single-payer system.)

Harris’s new plan would allow private insurance policies as long as they followed Medicare’s rules on quality and price, giving consumers a choice much like the one seniors currently have between Medicare and Medicare Advantage plans. Former Texas congressman Beto O’Rourke, who in 2017 embraced Medicare-for-all as the “best way,” now similarly supports a plan that would preserve the current employer-based insurance system.

This unmistakable, if sometimes subtle, shift in tone stems in part from Democrats’ fear of giving away a newfound advantage over Republicans on health care.

After the Affordable Care Act passed in 2010, Republicans scored major political victories by vowing to repeal the initially unpopular law. But when the GOP seized control of Washington under President Trump and tried to follow through on those promises, they faced a powerful backlash from voters who’d come to rely on the ACA.

Now some Democrats warn of the perils for their party in taking a position that, to important groups of voters, could seem just as disruptive as the GOP’s push to kill the ACA.

“There is nothing more personal to people than their health care,” said Kathleen Sebelius, who consulted on Harris’s plan and served as health and human services secretary in the Obama administration. “Anything that calls for the vast majority of Americans to lose what they have — that’s a very dangerous place to start a conversation.”

Five of the seven U.S. senators in the race have co-sponsored the Medicare-for-all bill drafted by Sen. Bernie Sanders (I-Vt.). But they have begun to shade their messages, suggesting that the bill represents a long-term vision rather than an immediate plan.

Where 2020 candidates stand on Medicare-for-all and other health-care issues

Many of the candidates are now focusing on steps they say would push the country closer to universal health care without a major disruption, such as creating a “public option” that would let people join Medicare without making it mandatory.

Sen. Cory Booker (N.J.), for example, co-sponsored the Sanders bill and emphasizes that he still supports it, but he describes himself as a “pragmatist” who would focus on “the immediate things we would do,” which do not include eliminating private health insurance.

Many Democrats argue that if Americans are given the choice of a public, government-run health option like Medicare, they will eventually see it as preferable to the private system and will migrate there on their own. That would create a government-run system without coercing people to join it, they say.

Sen. Kirstin Gillibrand (N.Y.), another co-sponsor of Sanders’s bill, stresses this approach. “I can go to anywhere in this country and say, ‘Why not have a not-for-profit public option that competes with your insurer charging you too much money?’ ” Gillibrand said Monday during a Washington Post Live event.

Even Sen. Elizabeth Warren (Mass.), who declared “I’m with Bernie on Medicare-for-all” at the first Democratic debate, has given herself wiggle room, saying that “there are a lot of different pathways” to achieving the goal of the Sanders bill.

Sanders himself is emphasizing his continued allegiance to a sweeping version of Medicare-for-all. That shows, he suggests, that he is the only candidate who can be trusted to fight for real change.

His campaign argues that allowing private insurance to remain, with all its inequities and privileges, would only perpetuate a tiered health-care system.

“The moment a person has to open their wallet to get health care in America is the moment that some people will be denied that right,” said Ari Rabin-Havt, chief of staff for Sanders’s campaign. “Anyone supporting plans that would leave millions without even basic coverage cannot claim to be standing for health care as a right.”

Still, Sanders has begun facing pushback on the campaign trail. At two stops in Iowa on Monday, he was asked whether Medicare-for-all would hurt the health plans of unionized workers, which have been negotiated to provide significant benefits. Sanders argues that Medicare-for-all would result in better coverage at a lower price.

Similar concerns are reflected in surveys. A Washington Post-ABC News poll in July found that 52 percent of Americans overall, and 77 percent of Democrats, prefer a universal health program to the current system. But support dropped to 43 percent and 66 percent, respectively, when respondents were told that it would mean eliminating private insurance.

Other surveys have found less support. About 8 in 10 Democrats and Democratic-leaning independents in a Pew poll in July said the federal government has a responsibility to ensure health coverage, but less than half said it should be through a single government plan.

And in a July poll of Iowa voters by CBS News/YouGov, two-thirds of Democrats said they preferred a government health program that competed with private insurance, compared with 34 percent who favored one that replaced private insurance entirely.

Such skepticism has encouraged candidates like former vice president Joe Biden, South Bend, Ind., Mayor Pete Buttigieg and Sen. Michael F. Bennet (Colo.) to stress their opposition to Medicare-for-all, even as they emphasize the goal of eventually reaching universal coverage.

But they continue to nod to the brand’s resonance with the Democratic base. Buttigieg calls his plan — which like Biden’s adds a public option to the current private system — “Medicare for all who want it.” O’Rourke calls his plan “Medicare for America.”

No candidate has fielded more criticism for her handling of this debate than Harris. She launched her campaign echoing Sanders’s language, saying she felt “very strongly” that Medicare-for-all was the best approach.

When she was asked on CNN in January what that meant for private health insurance, she spoke of the perpetual challenge that consumers face in getting insurers to approve important medical procedures. “Let’s eliminate all of that,” she said. “Let’s move on.”

Months later, Harris raised her hand in the first Democratic debate when candidates were asked, “Who here would abolish their private insurance?,” though she later said she thought the question referred only to her own personal coverage.

By then, she had begun seeking out an alternate approach, sitting down with her Senate chief of staff, Rohini Kosoglu, to explore possibilities, according to a campaign aide.

Kosoglu and Harris used Sanders’s bill as a template, the aide said, looking for ways to build on it while maintaining private insurance as an option. They sent drafts to experts, among them Kavita Patel, a Brookings fellow and former Obama health-care adviser who has consulted with other candidates as well.

“I think her primary concern was we can’t let Americans have less than they have today,” Patel said in an interview. “She was really trying to balance, ‘How can we make sure people can have choice?’ ”

That’s how Harris arrived at her plan: letting anyone enroll in Medicare but also allowing private insurance to continue as long as insurers followed Medicare’s rules. Harris also would provide a transition period of 10 years to switch over to the new system.

Critics say the plan is an attempt to avoid tough choices, but Harris’s team argues that it takes the best elements from all sides. Several health policy experts not affiliated with the campaign said that Harris’s plan could bridge the gap between Sanders and candidates like Biden, who wants to leave the ACA intact while building on it.

“In the last decade, the mood of the public has changed dramatically,” said Sebelius, the former HHS secretary. “I think this is about what the next step looks like: How far can we go? What’s realistic? How fast can we get there without a total disruption?”

As Harris peddled her new plan last week at campaign stops in Denver, Las Vegas and Iowa, she told voters she was proud of it.

She said the longer transition period would allow union members to continue reaping the benefits of their existing contracts, then negotiate next time with the new plan in mind. Voters would have choices, she contended, but insurance companies would no longer be able to “jack up” prices.

Other campaigns continue to fire at Harris for spending months supporting a plan that, by own her account, she was never comfortable with. But back on her bus, the candidate said she decided she was ready to brave the accusations of flip-flopping for the sake of the outcome.

“It’s going to be worth it,” she said. “I prefer to be out there with a plan I really believe in.”

Scott Clement contributed to this report.