WASHINGTON — House GOP leaders withdrew legislation to dismantle the Affordable Care Act after failing to reach consensus with Republican members on Friday, handing President Donald Trump and Speaker Paul Ryan an embarrassing loss after weeks of negotiations and 11th-hour pressure tactics with the party’s conservative wing.

“I will not sugarcoat this. This is a disappointing day for us,” Ryan said, casting the failure as the “growing pains” of the GOP now in power. “This is a setback. No two ways about it.”

The fate of the GOP’s long-held plan to repeal and replace Obamacare was left uncertain Friday, with Ryan saying Republican leaders will “figure out what the next steps are.” But many conservative lawmakers said Ryan privately told GOP members that health care is effectively dead for the rest of the year.

The news — announced just minutes before the House was expected to vote on the American Health Care Act — is a stunning defeat for Trump, who directly negotiated with conservative members on the bill this week. After a vote expected Thursday was postponed because of lack of support, the president issued an ultimatum that backfired: Support the bill or lose the chance to repeal Obamacare forever.

GOP leaders — who could afford just 22 defections from Republicans on the bill — were hoping their members would fall in line, lest they risk explaining to constituents back home why they voted against the bid to dismantle Obamacare.

But as the do-or-die vote neared closer Friday, several key moderates — uncomfortable with last-minute concessions made to the conservative wing — began dropping off from the effort, too.

Congressman Rodney Frelinghuysen of New Jersey, chairman of the powerful House Appropriations Committee, said the bill would raise costs unacceptably on his constituents. Rep. Barbara Comstock of Virginia, a key moderate Republican, and Rep. David Joyce, R-Ohio, also announced "no" votes.

Though the decision to pull the bill was a win for the House Freedom Caucus, which has opposed the measure on grounds it doesn’t do enough to repeal Obamacare, the legislation’s demise makes plain that neither Trump nor Ryan has control of the Republican caucus.

And for now, it leaves in place former President Barack Obama's signature health care law that GOP members have for years vowed to repeal.

Trump pinned the blame on Democrats, not the members of his party who opposed the measure.

"With no Democrat support, we couldn't quite get there," he told reporters in the Oval Office. "We learned about loyalty. We learned a lot about the vote-getting process."

The Affordable Care Act was approved in 2010 with no Republican votes. As Ryan convened the Republicans in the Capitol basement to announce the decision to pull the bill, Democrats were left standing by themselves on the House floor, goading their absent counterparts with chants of, “Vote! Vote! Vote!”

Ryan praised Trump’s attempts to reach consensus on the bill and declined to cast blame on members who revolted against the bill in recent weeks. Still, he noted it was easy for Republicans to unite “against things” when a Democrat sat in the White House. GOP House members voted dozens of times on legislation to repeal or replace the health care law while Obama was in office.

A number of Texas Republicans said Friday that they were disappointed the vote didn’t proceed — regardless of their support for the legislation. Some, like Dallas Rep. Jeb Hensarling, bemoaned that Republicans “allowed the perfect to become the enemy of the good.”

“I’m not going to second-guess the speaker, but I wish we’d have voted. It’s what people expected of us,” said Rep. Ted Poe, R-Humble, a member of the Freedom Caucus who announced his support for the measure after meeting with Trump. “People just got cold feet.”

Friendswood Rep. Randy Weber, a Freedom Caucus member who opposed the measure, chided GOP leaders for indicating the health care overhaul is dead for now.

“When we had a Democratic president in the White House, the House of Representatives passed 60 bills to repeal Obamacare,” Weber said. “Why in the world wouldn’t they try it more than once with a Republican president?”

President Donald Trump speaks about the House pulling its planned legislation to repeal the Affordable Care Act in the Oval Office of the White House in Washington on Friday. Trump, in a telephone interview moments after the bill was pulled, blamed Democrats and predicted that they would seek a deal within a year, he asserted, after "Obamacare explodes" because of high premiums. (Al Drago/The New York Times)

The Woodlands Rep. Kevin Brady, the chairman of the House Ways and Means Committee who helped craft the health care alternative, said his group will immediately proceed to rewriting the nation's tax laws.

Earlier this week, Trump warned that failure on the health care front would imperil the rest of the GOP’s agenda, including a tax overhaul and multinational trade deals.

Ryan acknowledged Friday’s setback “does make tax reform more difficult, but it does not in any way make it impossible.”

Democrats, who collectively decried the GOP plan as a massive tax giveaway for the wealthy and said it would make health care unaffordable for the country’s working poor, cheered Friday’s news.

“The people have spoken firmly against this bill,” Dallas Rep. Eddie Bernice Johnson said in a prepared statement. ”Republican leadership rushed their health care bill to the floor without enough consideration for the lives of the people it would affect.”

House Speaker Paul Ryan, R-Wis., announces that he is pulling the troubled Republican health care overhaul bill off the House floor on Friday. (J. Scott Applewhite/The Associated Press)

Republicans battled accusations of rushing the legislation because they attempted to pass the bill through a process called budget reconciliation, a maneuver that would have allowed them to tack the bill onto the fiscal year 2017 budget and required just a simple majority in the Senate.

The nonpartisan Congressional Budget Office estimated as many as 24 million more Americans would have lost or given up health coverage by 2026 if the AHCA were enacted, compared with current law. Customers would have paid 15 percent to 20 percent more initially, with premiums eventually dropping below current levels by 10 percent, according to the report.

The CBO, which released a revised assessment of the bill Thursday after GOP leaders amended the legislation, predicted it will shave $150 billion from the federal deficit over the next decade. The bill would have also blocked federal payments for a year to Planned Parenthood.

In the end, the nearly uniform opposition from hospitals, doctors, nurses, the AARP, consumer groups and others weighed heavily with many members.

Staff writer Jordan Rudner and The Associated Press contributed to this report.