WASHINGTON — President Trump suffered a stinging defeat Friday as Republicans shelved their plan to overhaul the U.S. health-care system and roll back the Affordable Care Act, despite the president's personal appeals on the first major legislative test of his young administration.

GOP leaders canceled a House vote on the plan after they couldn't secure the support to pass it, despite finally having control of the White House and both chambers of Congress. The collapse signaled the end, for at least some time, of their attempts to fulfill a long-held promise to repeal and replace the law often called Obamacare.

"Obamacare is the law of the land," House Speaker Paul Ryan said in a news conference. "We are going to be living with Obamacare for the foreseeable future."

Perhaps more significantly, the bill's collapse undercut the new president's attempts to validate his boasts as a deal-maker. Trump spent the previous week cajoling lawmakers in the White House and then, late Thursday, demanded they vote, essentially daring those in his own party to defy him.

Many did, including five GOP members of Congress  from the Philadelphia region. Three — Reps. Charlie Dent of Allentown, Brian Fitzpatrick of Bucks County, and Frank LoBiondo of South Jersey — had announced their opposition to the bill in recent days, edging it toward defeat.

Two others, Reps. Ryan Costello of Chester County and Pat Meehan of Delaware County, had backed the bill in committee hearings but said after the vote was canceled Friday they had intended to vote against it. All said their concerns had grown as more details came out and the bill was changed to appease conservatives.

By the end Friday, Rep. Tom MacArthur, a South Jersey Republican, was the only local congressman who remained a supporter. Every Democrat opposed the plan.

Trump had based much of his campaign and public persona on his ability to seal deals, and win. On this first test, he did neither. He blamed the failure on Democrats' refusal to offer any votes for the bill.

"The best thing we can do politically speaking is let Obamacare explode," he told reporters.

More broadly for Republicans, the failure showed the challenges they face in turning years of rhetoric and symbolic votes into policy, and raised questions about their ability to advance the rest of their agenda, even with a lock on power in Washington. After long using Obamacare as a campaign rallying cry, the GOP could not deliver on its promise to offer a viable alternative.

"It's important that we pivot toward some things that can be accomplished, principally tax reform, maybe infrastructure, but return to look at the question of health care incrementally," Meehan said.

The health plan Ryan crafted garnered only 17 percent support from the public, according to one poll, and even many Republicans who promised to repeal Obamacare balked. Conservatives said the proposal didn't go far enough for their liking -- and were widely blamed for torpedoing the bill — while moderates, including several from the Philadelphia area, also withheld support, worried that the measure was too harsh.

Some 24 million people would be uninsured under the GOP plan compared with existing law, the nonpartisan Congressional Budget Office estimated, and many with low incomes would have seen steep increases in costs.

LoBiondo, of the Atlantic City area, said the plan could have created a worse system. "Listening to all #SouthJersey residents. Won't vote to raise premiums, force seniors pay more, opioid abusers forgo treatment," he tweeted Friday afternoon.

Democrats reacted with glee.

"It's a victory for the American people," said House Minority Leader Nancy Pelosi.

"I have never seen an administration as incompetent as the one occupying the White House today," said Senate Minority Leader Chuck Schumer. "So much for The Art of the Deal."

And on Twitter, Sen. Bob Menendez (D., N.J.) piled on, writing, "Hey Republicans, don't worry, that burn is covered under the Affordable Care Act."

The Republican plan was designed to fulfill conservative calls to ease mandates on consumers and insurers and slash the government subsidies that help people pay for coverage. GOP leaders argued that it would lighten government's touch on Americans' health care, and instead rely on the free market. Taxes would be cut, with the biggest benefits flowing to wealthier Americans, while subsidies for insurance and spending on Medicaid, the health program for the poor and disabled, would be cut.

But by loosening regulations, the proposal was projected to lead to price spikes on older Americans and skimpier insurance plans with fewer required benefits. Democrats warned that people would pay more for less.

Among the provisions that would no longer be mandated, at the insistence of hard-line conservatives, were maternity care and coverage for substance abuse, a major concern in Pennsylvania, a state gripped by opioid abuse.

Gov. Wolf has said 125,000 Pennsylvanians have received addiction treatment under the existing law, and urged the state's Republicans to reject the bill.

More than one million people in Pennsylvania and New Jersey have gained insurance through Obamacare's Medicaid expansion -- which would have been rolled back starting in 2020. Wolf's administration has said the proposed Medicaid cuts could force the state to find $3 billion to maintain the current benefits. In New Jersey, Gov. Christie has said the Medicaid provisions have saved the state $2 billion.

Republicans who supported the bill made few arguments for its merits. Instead, they insisted they had to do something, anything, to erase Obamacare. Trump and Ryan argued that Democrats would bear the blame if premiums keep rising.

Mostly, the GOP seemed eager to get past an unpopular proposal.

"We were a 10-year opposition party where being against things was easy to do," Ryan said. He said the party would endure growing pains as it tried to govern. "We just weren't quite there today."