Despite a setback last week, the outlines of a Republican health care bill that could pass the Senate are emerging. But senior Republican aides and strategists on and off Capitol Hill told FiveThirtyEight that they are not optimistic and that they see clear challenges with the bill’s path forward, largely because of differences between the party’s more moderate wing and its conservatives.

In a clear illustration of those tensions, Senate Republicans missed two self-imposed, informal deadlines last week. A scheduled vote on a “motion to proceed” to start the formal process of passing the bill was postponed after members said they would oppose even this procedural step. Then senators failed to reach an agreement on the bill that would have allowed the party to move forward. Majority Leader Mitch McConnell reportedly sent at least two draft bills to the Congressional Budget Office to have them scored at the end of last week, but that’s only a partial step forward; Senate leaders routinely ask the CBO to score bills that will never be brought to the floor.

At the same time, Republicans, including President Trump, seem determined to pass some form of health care legislation to repeal and replace parts of the Affordable Care Act. So here are the three main steps to passage, according to interviews with people close to the process and details that have emerged publicly.

Step 1: Adopt Ted Cruz’s amendment to win over Cruz, Ron Johnson and Mike Lee.

Only hours after McConnell unveiled his draft bill on June 22, Sens. Ted Cruz of Texas, Ron Johnson of Wisconsin, Mike Lee of Utah and Rand Paul of Kentucky released a joint statement criticizing the bill as insufficiently conservative.

Cruz has proposed a major amendment to the bill. You might remember that the House version of the health care bill was changed, at the request of the conservative House Freedom Caucus, to allow states to waive some Obamacare rules, a shift that could allow insurers to charge people with pre-existing conditions more than other enrollees and to cover fewer services. McConnell’s bill, called the Better Care Reconciliation Act, had a similar provision. But Cruz wants to take this a step further. How would this work? Under Obamacare, all health care plans must cover at least 10 designated benefits, including maternity care, mental health care and emergency services. Cruz is proposing to allow insurance companies in each state to sell policies that don’t comply with this and other regulations, as long as the insurer is also selling some plans that do meet the full list of requirements.

The proposal aligns with conservatives’ anti-regulation stance. Conservatives such as Cruz argue that premiums are too high under Obamacare because health insurance has too many requirements. And if you are relatively healthy, Cruz’s proposal could save you money, since you could buy a cheaper insurance plan that didn’t cover benefits that you thought you were unlikely to need. But the provision could dramatically increase costs for people who already have illnesses. Why? People who don’t have specific health care needs are likely to choose a cheaper plan with less coverage. That would leave people with health issues or pre-existing conditions buying into the plans that met the Obamacare regulations. In turn, the cost of those more comprehensive plans could skyrocket. (A possible exception would be if the risk were pooled between the two kinds of plans; it’s not yet clear how this would work under Cruz’s amendment.)

Whatever its pluses and minuses, Cruz’s idea seems to have legs. Both Axios and the Washington Examiner reported that Republicans sent the proposal to the CBO for evaluation. And in an interview on Fox News Sunday, Marc Short, Trump’s director of legislative affairs, confirmed that the Cruz idea had been sent to the CBO and suggested that the Trump administration backed the proposal.

All of this should sound familiar. During the House health care bill process, the Freedom Caucus balked — but then added provisions that moved the bill to the right and helped get the legislation passed. You could imagine Cruz, Lee and Johnson doing something similar in response to Cruz’s amendment. Notice that I don’t necessarily include Paul in this group; more about him later.

McConnell may have to overcome one additional obstacle that House Speaker Paul Ryan did not face, however. There are questions about whether the Cruz provision follows the Senate’s reconciliation rules, the process by which senators hope to pass their bill with 51 votes rather than 60. The Senate parliamentarian could kill the Cruz amendment or force a substantial rewrite.

Step 2: Target additional spending — and perhaps reduce tax cuts — to win over Shelley Moore Capito, Rob Portman and Lisa Murkowski.

There’s a big, obvious potential problem with changing the bill in the way that Cruz wants: It could irritate moderates who are already wary of the legislation. Senators including Shelley Moore Capito of West Virginia, Susan Collins of Maine, Dean Heller of Nevada, Lisa Murkowski of Alaska and Rob Portman of Ohio already view McConnell’s legislation as too harsh in several respects, such as in its substantial cuts to Medicaid, the insurance program for low-income people.

The Cruz amendment would make matters worse with these moderates, especially if it gets an unfavorable CBO score. In December, the CBO stated that it might not count health care plans as “insurance” if they don’t offer enough financial protection or cover enough services. If the CBO feels that way about the bare-bones plans that Cruz’s amendment would allow, that could bump the projected number of uninsured higher than the 22 million additional uninsured that the CBO says would result if McConnell’s draft bill became law. Also, the CBO could conclude that the costs of insurance for people with pre-existing conditions would vastly increase under this legislation. The moderates would not greet these changes warmly.

So what’s the path forward for moderates? Let’s assume the CBO does not report a major increase in the number of uninsured people under the Cruz amendment. (If the CBO did report such an increase, McConnell might never bring the amendment to the floor.) Let’s also assume that McConnell’s primary focus is on winning over Capito, Portman and Murkowski and that Collins and Heller — who come from states won by Hillary Clinton in 2016 — will be harder to flip.

The CBO scored the original McConnell draft, with its Medicaid cuts and tax cuts, as saving the government $321 billion through 2026. By contrast, the House’s bill was scored as producing $119 billion in deficit reduction. Under reconciliation rules, the Senate’s bill must reduce the deficit by at least as much as the House’s. So the Senate has about $200 billion over 10 years to work with to make the bill more enticing to some members.

That gives McConnell room to create new provisions in the legislation or to add money to existing parts of it to appeal to moderates. There was only $2 billion in funds in his original bill specifically designated to deal with opioid abuse, for example. Drastically boosting that money — Republicans are considering putting in an additional $45 billion — could help win the votes of Capito and Portman, whose states have been hit hard by the opioid epidemic.

Alaska, where health care is exceptionally expensive to deliver, has its own issues. But congressional leaders have never lacked for creative solutions to local problems when they’re seeking to get key votes on board — such as the so-called “Louisiana Purchase” that Democrats used to secure Sen. Mary Landrieu’s vote on Obamacare, or the “Buffalo Buyoff” that Ryan used to win votes from upstate New York for the House’s version of the Republican bill. Perhaps McConnell could appease Murkowski by adding provisions to increase Medicaid funding for states that have very low population densities, for example.

Republicans are also considering keeping in place a 3.8 percent tax on investment income for couples who earn more than $250,000 a year. (The tax, which was introduced as part of Obamacare, would be repealed in McConnell’s draft bill.) The funds from that tax could be put toward Medicaid — thereby reducing the proposed cuts to the program — or toward slightly increasing subsidies for people who buy insurance on the exchanges set up by Obamacare.

Rolling back the tax cuts has some political risks. It could annoy anti-tax conservative groups such as Heritage Action for America and senators such as Cruz. It could also irritate conservatives in the House, which will have to vote on and approve any bill that passes the Senate. (Both chambers must pass the same version of any bill, and the House probably couldn’t pass the Senate’s version if the House Freedom Caucus opposed it.)

But again, there is a history here that should encourage Republicans and worry Democrats. On the eve of the health care vote in the House, GOP leaders were simultaneously able to add provisions that placated moderates — such as $8 billion of funding aimed at helping people with pre-existing conditions — and keep the Freedom Caucus on board.

Step 3: Appeal to party loyalty to get Rand Paul and other reluctant Republicans on board.

There’s another bloc of members who have not been as specific about their concerns about the bill but are not enthusiastic about it; Bill Cassidy of Louisiana, Jeff Flake of Arizona, Cory Gardner of Colorado, John McCain of Arizona, Ben Sasse of Nebraska and Bob Corker of Tennessee are among the leading figures in this group. But if more difficult votes such as Murkowski and Cruz fall in line, these members probably will do the same. Most represent relatively conservative states, making the prospect of being the person who voted down the Obamacare repeal somewhat unappealing politically.

Gardner is a somewhat more complicated case, since he is up for re-election in 2020 in a blue state, but he’s also been highly loyal to Trump and the Republican leadership, having voted with Trump’s position 95 percent of the time so far this year.

Paul could be a bigger problem. His positioning has been somewhat different from Cruz and Lee’s in that he has been criticizing the legislation for months and doing so more sharply than his colleagues. He has laid out a series of proposals for the McConnell bill that are to the right of even Cruz — proposing to get rid of all of the subsidies in the bill that would help people pay for insurance, for example. He developed something of a rivalry with Trump during the GOP primary debates, and he’s been comparatively willing to defy him so far; Paul’s Trump agreement score of 88 percent is the lowest of any GOP senator but Collins.

Nonetheless, Trump won overwhelmingly in Kentucky in 2016, and he’s personally lobbying Paul. And McConnell, Paul’s fellow Kentuckian, was the only senator to endorse Paul’s presidential bid. So Paul may be a potential “yes” vote, despite his public posture.

If Paul holds firm, Republicans will have to turn to Heller or Collins instead. Neither vote is impossible to imagine — Collins usually seeks out compromise, and Heller usually votes with party leadership; Republicans are still pressuring him to reconsider. But both senators have much stronger electoral incentives to vote against the bill than Paul does.

To conclude, what we’ve described here is a realistic scenario for Republicans, but also a very hard one. Fifty of the 52 Senate Republicans would have to agree to change the already unpopular health care bill in ways that could deepen the public’s concerns about it, such as by weakening protections for people with pre-existing conditions. At least 12 members would have to move from “having reservations” to “yes.” And the Republicans are trying to make these changes and vote by July 28, after which they leave for summer recess. Getting this bill passed would show that McConnell is a great strategist, but he doesn’t have an easy hand to play.

Anna Maria Barry-Jester contributed to this article.