President Obama is learning the hard way that “ending” a war by withdrawing our troops before our enemy is subdued ends nothing; in fact, it invites a reignition of violence. And having left once, it becomes doubly hard to rally public opinion to do what is required to re-win a war. The Obama doctrine has been repudiated by Obama. He has been forced to acknowledge that we didn’t “end” the Iraq war by bugging out:

President Obama spoke Thursday about the deteriorating situation in Iraq as the Islamic State in Iraq and Syria (ISIS) moved toward Baghdad after taking over northern Iraqi cities. (Win McNamee/Getty Images)

It is in our national security interests not to see an all-out civil war inside of Iraq, not just for humanitarian reasons, but because that ultimately can be destabilizing throughout the region. And in addition to having strong allies there that we are committed to protecting, obviously, issues like energy and global energy markets continue to be important.

We also have an interest in making sure that we don’t have a safe haven that continues to grow for ISIL and other extremist jihadist groups who could use that as a base of operations for planning and targeting ourselves, our personnel overseas and eventually the homeland. And you know, if they accumulate more money, they accumulate more ammunition, more military capability, larger numbers, that poses great dangers not just to allies of ours like Jordan, which is very close by, but it also poses, you know, a great danger, potentially, to Europe and ultimately the United States.

The mess he now faces is the direct result of his delusion that the United States could withdraw and leave the Middle East to its own devices. (Remember the “pivot” to Asia?) Had he finished the job in Iraq by leaving a residual force, stood up to Iran’s proxy in Syria and, most of all, not remained inert when the Green Revolution occurred, he would not now be facing in essence a two-front struggle against both al-Qaeda and an increasingly confident Iran. He is in a terrible jam — America is in a jam — and could do without the Bush-blaming. Instead he should look to his predecessor as a model for reversing course to save the country and our allies from a humiliating defeat and ongoing terrorist threat.

Unfortunately he hasn’t yet shown the insight and political courage to do what is needed to secure our objectives. Hence, he is already ruling out direct use of force. (“American combat troops are not going to be fighting in Iraq again.”) Sending 300 advisers is a start but will be utterly insufficient to restore Iraq to its condition (stable, peaceful) when Bush departed.

When it comes to Syria, Obama resorts to blatant untruths, claiming he could never find “moderate opposition on the ground to absorb and counteract extremists that might have been pouring in.” Those extremists poured in, of course, when we did not put muscle behind our rhetoric and help push Assad out quickly. I suspect Hillary Clinton might recall events that way.

When it comes to Iran, the president is incoherent. On one hand, he thinks that despite Iran’s role in instigating partisan animosity in Iraq “our view is that Iran can play a constructive role.” On the other hand, he concedes that “we have deep differences with Iran across the board on a whole host of issues. Obviously what’s happened in Syria in part is the result of Iran coming in hot and heavy on one side.” So Iran isn’t so constructive, huh?

And then he resorts to an old saw — there are “moderates” somewhere in Iran who understand they can’t be instigators of  Shite sectarian violence. (“Iran obviously should consider the fact that if it is — if its view of the region is solely through sectarian frames, they could find themselves fighting a whole lot of places. And that’s probably not good for the Iranian economy or the Iranian people over the long term either. I suspect there are folks in Iran who recognize that. You know, an Iraq in chaos on their borders is probably not in their interests. But old habits die hard. And you know, we’ll have to see whether they can take what I think would be a more promising path over the next several days.”) Where are these “folks”? Certainly they aren’t in a position to discontinue state sponsorship of terrorism, end domestic oppression or come into compliance with international obligations on its nuclear program. He would do better to warn “these folks” that he won’t tolerate Iranian domination of Iraq, nor will he give the mullahs a sweetheart deal on nukes to avoid Iranian mischief in Iraq.

The president is all over the place and I suspect doesn’t have the foggiest idea how to simultaneously disengage and prevent an inferno and jihadist state. In fact he can’t. Honest and capable advisers would tell him so. As The Post’s editorial board puts it, “Mr. Obama had gambled that the United States could withdraw from Iraq and (by 2016) Afghanistan while staying aloof from the civil war in Syria. The result has been growing turmoil that he can no longer ignore: humanitarian catastrophes in both Syria and Iraq; widening territory under the control of a vicious al-Qaeda offshoot with a goal of sending attackers into the United States; and, once again, a potential bloody disintegration of Iraq.”

Whether he publicly admits it or not, Obama, like Bush, must decide if he wants to turn around a losing policy, put aside electoral concerns and do what is necessary to ensure that Iraq doesn’t become a jihadist state. I suspect he does not but pray I have underestimated him.