War, it's been said, is God's way of teaching Americans geography. Maybe we do learn how to locate the countries we invade or bomb on a map. But recent experience indicates how much we don't know about those societies and how slow we are at learning.

The United States is still involved in a 13-year-old war in Afghanistan, and President Barack Obama has undertaken a new one against Islamic State in Iraq and Syria, just three years after he withdrew the last of our troops from Iraq. The administration is also carrying on a drone missile campaign—which looks eerily like war from the receiving end—in Pakistan and Yemen.

Yet the republic has just concluded an election campaign that gave almost no attention to what the United States government is doing, or should be doing, in these places. For the most part, the topic was discussed in only the vaguest terms, but often it was simply absent. No country in history has ever done so much fighting in so many places with so little interest from its own citizens.

Nor do the people in power who make these ambitious commitments necessarily have a clue where they will lead. Over and over, things turn out in ways that come as a complete and thoroughly unwelcome surprise.

No one could have imagined in October 2001, when we went into Afghanistan to crush the Taliban and al-Qaida, that we would still be there 13 years later and so would they. Nor did we realize that our crucial supposed ally in the fight, Pakistan, would prove not merely unhelpful but downright hostile.

As New York Times correspondent Carlotta Gall documented in her book "The Wrong Enemy: America in Afghanistan, 2001-2014," the government of Pakistan was actively helping our foes while reaping $23 billion in aid from Washington. U.S. envoy Richard Holbrooke eventually realized, "We may be fighting the wrong enemy in the wrong country."

Unexpected? Of course. But it's the sort of thing that happens when governments act with slivers of knowledge and mountains of hubris, relying on bright visions and brute force. That's how we stormed into Iraq and won a swift military victory—which we proceeded to squander by disbanding the Iraqi military and banning former members of Saddam Hussein's party from the new government.

Both decisions sounded sensible—but only because our leaders were so ignorant of Iraq that they had no idea what the effects would be. In practice, we managed to turn huge numbers of Iraqis against us and spawn an insurgency that would kill thousands of our troops. We also inadvertently rained blessings on our longtime enemy to the east. The U.S. fought a war against Iraq, and the winner was Iran.

The war on Islamic State is even more rife with uncertainty, because so many of its enemies are our enemies. If we do damage to it, we are indirectly strengthening the mullahs in Tehran, al-Qaida and Syrian dictator Bashar Assad. We're also bolstering the irresponsible Shiite-dominated government in Baghdad whose persecution of Sunnis gave rise to the group.

The Wall Street Journal reports that by hitting Islamic State targets in Syria, we helped al-Qaida units to defeat the "moderate" Syrian rebels we have helped in their fight against Assad. Meanwhile, our NATO ally Turkey balks at assisting us. Why? Because those fighting on "our" side include Kurdish groups allied with separatists it has been fighting for 30 years.

For that matter, the U.S. air war is the best recruiting tool the Islamic State ever had. Already, a confidential UN Security Council report recently noted, some 15,000 foreigners have poured into the region to join it and other extremist groups.

"Numbers since 2010 are now many times the size of the cumulative numbers of foreign terrorist fighters between 1990 and 2010—and are growing," it said, according to The Guardian. As usual, we're creating jihadis faster than we kill them. Chances are excellent that we are also sowing an array of unforeseen problems that will haunt us for years to come.

For most of this century, we've been fighting wars to enhance our security, and each time, we find ourselves with more enemies and less security. By now it should be clear that is not a coincidence. If the war on Islamic State solves nothing or makes things worse, we will be unhappy, but we shouldn't be surprised.