President Trump on Friday abruptly scrapped a vote on his health-care plan after House Speaker Paul Ryan said he couldn’t deliver the votes to pass it — a stunning blow to a president who has long vowed to repeal and replace ObamaCare.

Trump, who had initially demanded Friday’s vote, later spun the defeat by arguing that the Republican-backed measure’s failure was the best outcome because it would leave ObamaCare to “explode” on its own under crushing premiums.

“I think the losers are [House Minority Leader] Nancy Pelosi and [Senate Minority Leader] Chuck Schumer because now they own ObamaCare. They own it, 100 percent own it,” he said from the White House.

“I think there wasn’t a speech I made or very few where I didn’t mention that perhaps the best thing that could happen is exactly what happened today, because we’ll end up with a truly great health-care bill in the future after this mess known as ObamaCare explodes,” he said. “This is going to be a very good thing.”

Schumer mocked Trump shortly after the bill was yanked.

“So much for the Art of the Deal,” the New York senator snarked, taking a jab at Trump’s 1987 book of the same name.

“They can’t write policy that actually makes sense, they can’t implement the policies they do manage to write, they can’t get their stories straight, and today we’ve learned that they can’t close a deal, and they can’t count votes,” he added.

Trump blamed the Democrats, pointing out that not a single one supported his measure — even though it was GOP defections that led to its downfall.

He estimated that the bill was 10 to 15 votes shy of passing.

He said that health-care reform was now on the back burner, and that he would focus on tax reform.

Ryan had earlier trekked to the White House to deliver the news that he and the administration, despite weeks of intense lobbying, couldn’t persuade enough members of their own party to fall in line behind the measure.

As a result, he said, ObamaCare would remain in effect “for the foreseeable future.”

Ryan later admitted at a Capitol Hill news conference that he and the president had failed to deliver on one of their key campaign promises.

“I will not sugarcoat this. This is a disappointing day for us. This is a setback — no two ways about it,” Ryan said, adding that he told Trump the best course of action was to pull the bill, and that the president agreed.

The speaker — who Trump said earlier should not lose his job if the bill failed — blamed the debacle on “growing pains.”

“Moving from an opposition party to a governing party comes with growing pains, and, well, we’re feeling those growing pains today. We came really close today, but we came up short. Doing big things is hard,” he said.

Ryan lavished praise on Trump for his efforts to win support among wayward House Republicans, especially those in the conservative Freedom Caucus.

“The president gave his all in this effort. He did everything he possibly could to help people see the opportunity that we have with this bill. He’s really been fantastic,” he gushed.

Trump said he was “a little surprised” that many Freedom Caucus members — “friends of mine” — couldn’t be swayed.

Ryan admitted the defeat could make it harder for Team Trump to advance its agenda, ­including tax reform and big spikes in military and infrastructure spending.

“Yes, this does make tax reform more difficult, but it doesn’t make it impossible,” he said.

“We’re going to move on with the rest of our agenda.”

Hillary Clinton, meanwhile, gloated on Twitter.

“Today was a victory for all Americans,” she tweeted.

Rep. Trent Franks (R-Ariz.) said he was confident the health-care issue would be revisited.

“Abraham Lincoln once said the best way to repeal a bad law is to enforce it strictly,” he said.

Asked whether Trump had failed, he said: “If anything, the House of Representatives failed the president.”