The writer, a retired Marine lieutenant general, is co-author of “The Endgame: The Inside Story of the Struggle for Iraq, from George W. Bush to Barack Obama.”

Abu Bakr al-Baghdadi and his band of Islamic State zealots received international attention for their brutality and lightning sweep across Iraq, but the United States should know better than to respond with a clarion call to battle. We have already been burned trying to solve the Rubik’s cube of the Middle East. U.S. actions in the region should remain calculating, patient — and detached.

The Islamic State presents a problem to be managed, not a war to be won. Much of what it occupies in Syria and Iraq is useless desert. The situation is stabilizing, largely because of limited U.S. airstrikes, and the immediate crisis is over. The Iraqi Kurds have stiffened their defenses, and Shiites backed by Iran are defending Baghdad. Even Anbar Province’s Sunni tribes pose a problem for the interlopers.

The Islamic State blitzkrieg can be seen as the latest iteration of the struggle for ascendancy by radical Muslims, but at the core it is a local matter, and brutality is unfortunately part of the package. The U.S. role should be limited to helping Kurdish forces and the new Baghdad government better organize to keep the pressure on, with U.S. airstrikes contingent on their progress. The president’s attempt to form an international posse to assist makes sense, and the results have been reasonably encouraging. France and a fistful of Arab states are already actively engaged.

But it is a stalemate in the making. The United States could break the stalemate by introducing ground combat forces, but all that would achieve is the recovery of lost ground. Meanwhile, the Islamic State could dodge and feint, drawing U.S. troops into the Syrian maelstrom. There is no appetite in the United States for that.

The idea of destroying the Islamic State, an expression of a centuries-old goal to establish a caliphate in the Muslim world, and restoring stability is nonsense. Stability, in the peaceful sense of the word, is a chimera. More realistic would be to accept a tolerable level of violence within the region so long as no faction that is a direct U.S. threat achieves dominance. Director of National Intelligence James Clapper’s view is that the Islamic State poses only a “strategic threat . . . long term.” Terrorism, from myriad Islamist groups, is the more clear and present danger.

The situation in Mesopotamia is a violent game of mistrust and self-interest. The Saudis despise the Iranians but will cut deals with them if doing so is in their interest. Iran will play any card necessary to achieve regional hegemony, while Turkey is coy about its own quest for preeminence. The Gulf States talk out of both sides of their mouths. Syrian dictator Bashar al-Assad uses the Islamic State to create problems for other rebels. Iraq plays at democracy as long as it can subjugate the Sunnis. Shiites and Sunnis fight each other while carrying on intramural warfare with their kinsmen. The double-dealing is almost endless. It doesn’t make sense to us, but it does to the players.

After more than a decade of frustration and humiliation, the United States should have learned that the Middle East is no place for Wilsonianism on steriods. Obama cut his teeth as a community organizer on the mean streets of Chicago. He should be wary of journeying too far into a bad neighborhood when he sees one.