In the end, President Trump was stymied by the bitter warfare that for years has divided the Republican Party into two camps: the purists vs. the pragmatists.

When the purists wouldn’t budge, Paul Ryan couldn’t round up enough votes for the White House.

Reince Priebus is among those blaming the House Freedom Caucus. “We can't be chasing the perfect all the time,” the chief of staff told Chris Wallace on Sunday. “Sometimes you have to take good and put it in your pocket and take the win.”

Ted Poe, a Texas congressman who quit the Freedom Caucus, told “Fox & Friends” yesterday that Trump and Ryan made several changes demanded by his group after visiting with caucus members. “But no matter what changes were made, the goal post kept getting moved and at the end of the day, ‘no’ was the answer,” Poe said. “And sometimes you’re going to have to say yes.”

Or not.

There’s a long history here. The Republicans, led by Ted Cruz, shut down the government in 2013 rather than fund ObamaCare, but they wound up taking a political hit while the health program emerged unscathed.

The intransigence by his right wing ultimately led John Boehner to resign. The former speaker tried to cut a tax-and-spending “grand bargain” with Barack Obama but couldn’t deliver the votes. Boehner was facing another potential government shutdown in the fall of 2015 when he quit his job. Ryan didn’t particularly want the speaker's gavel and had to be drafted.

It’s noteworthy that the president hasn’t blamed Ryan, but tweeted the following: “Democrats are smiling in D.C. that the Freedom Caucus, with the help of Club For Growth and Heritage, have saved Planned Parenthood & Ocare!”

In fairness, members of the Freedom Caucus were acting on principle, believing that the rushed health bill was an abomination that not only failed to repeal the Obama program but would have made things worse.

Trump campaigned on a much more moderate position on health care. In fact, it’s helpful to think of him as an independent president, since he ran against the Republican establishment and rejected key conservative platforms on taxes and spending.

So where does the president go from here as he turns to tax reform and infrastructure?

If the Freedom Caucus keeps depriving him of a Republican majority, Trump could try to win over some moderate Democrats, as Ronald Reagan did.

But Politico says Nancy Pelosi is now “empowered,” and the New York Times says “Democrats will not be lending a hand anytime soon.

"Invigorated by the Republican dysfunction that led to a stunningly swift collapse of the effort to repeal the Affordable Care Act, and relieved that President Barack Obama’s signature domestic accomplishment remains intact, Democrats are in their best position since their embarrassing loss in the November election.”

The Weekly Standard reports “there's not much appetite in the White House for dealing with the Freedom Caucus,” citing an unnamed White House aide as arguing "there's practically no reason to consider the demands of the Freedom Caucus or its chairman, North Carolina's Mark Meadows, on anything important again.”

But, says the piece by Michael Warren, “What incentive do Nancy Pelosi and Democratic leadership, who have control over committee assignments and campaign contributions, have in releasing its members to support the Trump administration on almost anything difficult?”

Two possible answers: If the Democrats don’t cooperate with Trump on a couple of issues, they will take heat for being obstructionist (a label they threw at Mitch McConnell when they ran Congress). Also, they might be able to get half a loaf on their priorities rather than being totally sidelined.

None of this is going to be easy. On tax reform, the Democrats always want higher taxes on the wealthy, which is anathema to the GOP. But if Trump is going to prove himself a pragmatic dealmaker, he may need to put together some shifting coalitions.