After the pro-Western government of China was forced to flee to the island of Taiwan in 1949, when the Communists took over mainland China, bitter recriminations in Washington led to the question: “Who lost China?” China was, of course, never ours to lose, though it might be legitimate to ask if a different American policy toward China could have led to a different outcome.

In more recent years, however, Iraq was in fact ours to lose, after U.S. troops vanquished Saddam Hussein’s army and took over the country. Today, we seem to be in the process of losing Iraq, if not to ISIS, then to Iran, whose troops are in Iraq fighting ISIS.

While mistakes were made by both the Bush administration and the Obama administration, those mistakes were of different kinds and of different magnitudes in their consequences, though both sets of mistakes are worth thinking about, so that so much tragic waste of blood and treasure does not happen again.

Whether it was a mistake to invade Iraq in the first place is something that will no doubt be debated by historians and others for years to come. But, despite things that could have been done differently in Iraq during the Bush administration, in the end President Bush listened to his generals and launched the military “surge” that crushed the terrorist insurgents and made Iraq a viable country.

The most solid confirmations of the military success in Iraq were the intercepted messages from Al Qaeda operatives in Iraq to their leaders in Pakistan that there was no point sending more insurgents, because they now had no chance of prevailing against American forces. This was the situation that Barack Obama inherited — and lost.

Going back to square one, what lessons might we learn from the whole experience of the Iraq war? If nothing else, we should never again imagine that we can engage in “nation-building” in the sweeping sense that term acquired in Iraq — least of all building a democratic Arab nation in a region of the world that has never had such a thing in a history that goes back thousands of years.

Human beings are not inert building blocks, and democracy has prerequisites that Western nations took centuries to develop. Perhaps the reshaping of German society and Japanese society under American occupation after World War II made such a project seem doable in Iraq.

Had the Bush administration pulled it off, such an achievement in the Middle East could have been a magnificent gift to the entire world, bringing peace to a region that has been the spearhead of war and international terrorism.

Replacing German and Japanese dictatorships with democracy after World War II was a challenge. But both countries remained under American military governments for years, slowly gaining such self-governing powers as the military overseers chose, and at such a pace as these overseers deemed prudent in the light of conditions on the ground.

American authorities did not rush to set up an independent government, able to operate at cross purposes because it was “democratically elected” in a country without the prerequisites of a viable democracy.

Despite the mistakes that were made in Iraq, it was still a viable country until Barack Obama made the headstrong decision to pull out all the troops, ignoring his own military advisers, just so he could claim to have restored “peace,” when in fact he invited chaos and defeat.