Mr. Trump, in a telephone interview moments after the bill was pulled, tried to put the most flattering light on it. “The best thing that could happen is exactly what happened — watch,” he said.
“Obamacare unfortunately will explode,” Mr. Trump said later. “It’s going to have a very bad year.” At some point, he said, after another round of big premium increases, “Democrats will come to us and say, ‘Look, let’s get together and get a great health care bill or plan that’s really great for the people of our country.’”
Mr. Trump expressed weariness with the effort, though its failure took a fraction of the time that Democrats devoted to enacting the Affordable Care Act in 2009 and 2010. “It’s enough already,” the president said.
A major reason for the bill’s demise was the opposition of members of the conservative House Freedom Caucus, which wanted more aggressive steps to lower insurance costs and to dismantle federal regulation of insurance products.
In a day of high drama, Mr. Ryan rushed to the White House shortly after noon on Friday to tell Mr. Trump he did not have the votes for a repeal bill that had been promised for seven years — since Mr. Obama signed the landmark health care law. During a 3 p.m. phone call, the two men decided to withdraw the bill rather than watch its defeat on the House floor.
Mr. Trump later told journalists in the Oval Office that Republicans were 10 to 15 votes short of what they needed to pass the repeal bill.
The effort to win passage had been relentless, and hardly hidden. Vice President Mike Pence and Tom Price, the health secretary, visited Capitol Hill on Friday for a late appeal to House conservatives, but their pleas fell on deaf ears.
“You can’t pretend and say this is a win for us,” said Representative Mark Walker of North Carolina, the chairman of the conservative Republican Study Committee, who conceded it was a “good moment” for Democrats.
“Probably that champagne that wasn’t popped back in November may be utilized this evening,” Mr. Walker said.
At 3:30 p.m. on Friday, Mr. Ryan called Republicans into a closed-door meeting to deliver the news that the bill would be withdrawn, with no plans to try again. The meeting lasted five minutes. One of the architects of the House bill, Representative Greg Walden, Republican of Oregon and the chairman of the Energy and Commerce Committee, put it bluntly: “This bill’s done.”
“We are going to focus on other issues at this point,” he said.
The Republican bill would have repealed tax penalties for people without health insurance, rolled back federal insurance standards, reduced subsidies for the purchase of private insurance and set new limits on spending for Medicaid, the federal-state program that covers more than 70 million low-income people. The bill would have repealed hundreds of billions of dollars in taxes imposed by the Affordable Care Act and would also have cut off federal funds to Planned Parenthood for one year.
Mr. Ryan had said the bill included “huge conservative wins.” But it never won over conservatives who wanted a more thorough eradication of the Affordable Care Act. Nor did it have the backing of more moderate Republicans who were anxiously aware of the Congressional Budget Office’s assessment that the bill would leave 24 million more Americans without insurance in 2024, compared with the number who would be uninsured under the current law.
The budget office also warned that in the short run, the Republicans’ legislation would drive insurance premiums higher. For older Americans approaching retirement, the cost of insurance could have risen sharply.
With the House’s most hard-line conservatives holding fast against the bill, support for the legislation collapsed Friday after more and more Republicans came out in opposition. They included Representatives Rodney Frelinghuysen of New Jersey, the soft-spoken chairman of the House Appropriations Committee, and Barbara Comstock of Virginia, whose suburban Washington district went for the Democratic presidential nominee, Hillary Clinton, in November.
“Seven years after enactment of Obamacare, I wanted to support legislation that made positive changes to rescue health care in America,” Mr. Frelinghuysen said. “Unfortunately, the legislation before the House today is currently unacceptable as it would place significant new costs and barriers to care on my constituents in New Jersey.”
The bill died after Republican leaders, in a bid for conservative support, agreed to eliminate federal standards for the minimum benefits that must be provided by certain health insurance policies.
“It’s so cartoonishly malicious that I can picture someone twirling their mustache as they drafted it in their secret Capitol lair last night,” said Representative Jim McGovern, Democrat of Massachusetts. “Republicans are killing the requirements that insurance plans cover essential health benefits” such as emergency services, maternity care, mental health care, substance abuse treatment and prescription drugs.
Mr. Trump blamed Democrats for the bill’s defeat, and they proudly accepted responsibility.
“Let’s just, for a moment, breathe a sigh of relief for the American people that the Affordable Care Act was not repealed,” said Representative Nancy Pelosi of California, the House Democratic leader.
Defeat of the bill could be a catalyst if it forces Republicans and Democrats to work together to improve the Affordable Care Act, which members of both parties say needs repair. Democrats have been saying for weeks that they want to work with Republicans on such changes, but first, they said, Republicans must abandon their drive to repeal the law.
“Obamacare is the law of the land,” Mr. Ryan said. “It’s going to remain the law of the land until it’s replaced.”
Whatever success Mr. Trump had in making business deals, he utterly failed in his first effort at cutting a deal at the pinnacle of power in Washington, Democrats said.
“This is not the art of the deal,” said Representative Lloyd Doggett, Democrat of Texas, alluding to Mr. Trump’s best-selling book. “It is the art of the steal, of taking away insurance coverage from families that really need it to provide tax breaks for those at the very top.”
Rejection of the repeal bill may prompt Republicans to reconsider the political strategy they were planning to use for the next few years.
“We have to do some soul-searching internally to determine whether or not we are even capable of functioning as a governing body,” said Representative Kevin Cramer, Republican of North Dakota. “If ‘no’ is your goal, it’s the easiest goal in the world to reach.”
Representative Robert Pittenger, Republican of North Carolina, offered this advice to hard-line conservatives who helped sink the bill: “Follow the example of Ronald Reagan. He was a master; he built consensus. He would say, ‘I’ll take 80 percent and come back for the other 20 percent later.’”
Failure of the House effort leaves the Affordable Care Act in place, with all the features Republicans detest.
“We tried our hardest,” said Representative Michael C. Burgess of Texas, chairman of the Energy and Commerce subcommittee on health. “There were people who were not interested in solving the problem. They win today.”
“The Freedom Caucus wins,” he added. “They get Obamacare forever.”