In 2011, the situation in Iraq was so good that the Obama administration was actually trying to take credit for it, with Vice President Joe Biden declaring that Iraq “could be one of the great achievements of this administration.”

Now in 2014, as Iraq descends into chaos, Democrats are trying to blame the fiasco on — you guessed it — George W. Bush. “I don’t think this is our responsibility,” said House Minority Leader Nancy Pelosi, declaring that the unfolding disaster in Iraq “represents the failed policies that took us down this path 10 years ago.”

Sorry, but this is a mess of President Obama’s making.

When Obama took office he inherited a pacified Iraq, where the terrorists had been defeated both militarily and ideologically.

Militarily, thanks to Bush’s surge, coupled with the Sunni Awakening, al-Qaeda in Iraq (AQI, now the Islamic State of Iraq and Syria, or ISIS) was driven from the strongholds it had established in Anbar and other Iraqi provinces. It controlled no major territory, and its top leader — Abu Musab al-Zarqawi — had been killed by U.S. Special Operations forces.

Ideologically, the terrorists had suffered a popular rejection. Iraq was supposed to be a place where al-Qaeda rallied the Sunni masses to drive America out, but instead, the Sunnis joined with Americans to drive al-Qaeda out — a massive ideological defeat.

Obama took that inheritance and squandered it, with two catastrophic mistakes:

First, he withdrew all U.S. forces from Iraq — allowing the defeated terrorists to regroup and reconstitute themselves.

Second, he failed to support the moderate, pro-Western opposition in neighboring Syria — creating room for ISIS to fill the security vacuum. ISIS took over large swaths of Syrian territory, established a safe haven, used it to recruit and train thousands of jihadists, and prepared their current offensive in Iraq.

The result: When Obama took office, the terrorists had been driven from their safe havens; now they are on threatening to take control of a nation. Iraq is on the cusp of turning into what Afghanistan was in the 1990s — a safe haven from which to plan attacks on America and its allies.

It did not have to be this way. In 2011, the U.S. commander in Iraq, Gen. Lloyd J. Austin III, recommended keeping between 14,000 and 18,000 troops in Iraq (down from 45,000). The White House rejected Austin’s recommendation, worried about “the cost and the political optics.” So our commanders reduced their request to 10,000 — a number commanders said might be able to work “in extremis.” But the White House rejected this as well, insisting the number be cut to between 3,000 to 4,000 troops — a level insufficient to provide force protection and train Iraqis, much less to counterbalance Iran.

Iraqi leaders saw that the United States has headed for the exits — and decided that the tiny U.S. force Obama was willing to leave behind was not worth the political costs of giving Americans immunity from prosecution in the Iraqi judicial system. So Iraq rejected Obama’s offer, and the United States withdrew all its forces. And now ISIS is taking back cities that were liberated with American blood. It has taken control of Mosul, Tikrit and Tal Afar and is nearing the outskirts of Baghdad.

ISIS is not the only U.S. enemy taking advantage of power vacuum Obama left in the region. So is Iran. A month ago, Iraqi leaders asked the United States to carry out air strikes against ISIS positions but were rebuffed by Obama. So the Iraqis have turned to Iran for help. This weekend, the brutal commander of Iran’s notorious Quds Force, Gen. Quasim Suleiman, flew to Baghdad to advise the Iraqis on the defense of Baghdad. This is the man who organized and funded the Shia militias in Iraq, and armed them with EFPs (explosively formed penetrators) — sophisticated armor-piercing roadside bombs that killed hundreds of U.S. troops. And, if you thought matters could not get any worse, the Wall Street Journal reports that Obama “is preparing to open direct talks with Iran on how the two longtime foes can counter the insurgents.” Yes, you read that right. Obama is planning to work with Iran to counter ISIS in Iraq. In other words, our troops may soon be providing air cover for the very Iranians who were killing them.

If Obama had listened to the advice of his commanders on the ground, ISIS would probably not be marching on Baghdad today, and Iran would not be stepping in to fill the void left by the U.S. withdrawal. Thanks to Obama, we may soon have a situation where we are helping our Shia extremist enemies (Iran) fight our Sunni extremist enemies (ISIS) for control of Iraq.

That’s quite an “achievement.”

Read more from Marc Thiessen’s archive, follow him on Twitter or subscribe to his updates on Facebook.