WASHINGTON — In a humiliating setback, President Donald Trump and GOP leaders pulled their "Obamacare" repeal bill off the House floor Friday after it became clear the measure would fail badly.

It was a stunning defeat for the new president after he had demanded House Republicans vote on the legislation Friday, threatening to leave "Obamacare" in place and move on to other issues if the vote failed. The bill was withdrawn minutes before the vote was to occur.

Republicans have spent seven years campaigning against former President Barack Obama's health care law, and cast dozens of votes to repeal it in full or in part. But when they finally got the chance to pass a repeal bill that actually had a chance to get signed, they couldn't pull it off.

What happens next is unclear, but the path ahead on other priorities, such as overhauling the tax code, can only grow more daunting.

Democrats in New Jersey applauded Friday's decision by the U.S. House not to vote on a health overhaul bill that could have left nearly half a million state residents without health care, a measure that four of the state's five Republican congressman had planned to vote against.

Rep. Rodney Frelinghuysen on Friday said that the legislation was "unacceptable," joining with Reps. Frank LoBiondo, Leonard Lance and Chris Smith, who had already announced their plans to vote against the bill.

A spokeswoman for the other Republican in the state's delegation, Rep. Tom MacArthur, said Friday morning that he still had planned to vote yes. The state's seven Democratic members of the House were all opposed to the measure.

About 476,000 fewer New Jersey residents would have health insurance by 2020 under the proposed replacement to the Affordable Care Act, an analysis by the liberal-leaning think tank New Jersey Policy Perspective found this week.

Frelinghuysen, who chairs the powerful House appropriations committee, said that the legislation would place "significant new costs and barriers to care" on his constituents.

"In addition to the loss of Medicaid coverage for so many people in my Medicaid-dependent state, the denial of essential health benefits in the individual market raise serious coverage and cost issues," Frelinghuysen said. "I remain hopeful that the American Health Care Act will be further modified. We need to get this right for all Americans."

LoBiondo announced earlier this week that he was against the measure and on Friday asked on Twitter that people stop calling his office "hourly" to inquire about his position. He said that he wouldn't be "arm-twisted" to support it.

He said that changes made by GOP leadership Thursday night strengthened his no vote and that changes to the essential benefit section would be a big issue for his southern New Jersey district.

Jon Whiten, of New Jersey Policy Perspective, said that the "fight to protect and expand affordable health care for all New Jerseyans is not over. But in this crucial round one, common sense, sound policy and better coverage have won the day."

Contact reporter Dan Alexander at Dan.Alexander@townsquaremedia.com.

More from New Jersey 101.5:

(Copyright 2017 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed)