Luay Abdullah, who was injured in recent bomb attacks, receives treatment at a hospital in Sadr City in Baghdad. (Karim Kadim/AP)

Iraq is collapsing as a country. This week’s bombings in Baghdad, which killed more than 90 people, are just further reminders that the place remains deeply unstable and violent. There is a lesson to be drawn from this, one that many powerful people in Washington are still resisting.

As Iraq has spiraled downward, policymakers have been quick to provide advice. Perennial hawks such as Sen. John McCain (R-Ariz.) have argued that if only the Obama administration would send more troops to the region, it would be more stable. Others say we need more diplomats and political advisers who can buttress military efforts. Still others tell us to focus on Iraqi leaders and get them to be more inclusive.

Perhaps it is worth stepping back from Iraq and looking at another country where the United States has been involved. The United States has been engaged in Afghanistan militarily, politically and economically for 15 years. It has had many “surges” of troops. It has spent more than $1 trillion on the war, by some estimates, and still pays a large portion of Afghanistan’s defense budget. Afghanistan has an elected government of national unity.

And yet, in October, the United Nations concluded that the insurgency had spread to more places in the country than at any point since 2001. Danielle Moylan reported in the New York Times that the Taliban now controls or contests all but three districts in Helmand province. She said that 36,000 police officers — almost a quarter of the force — are believed to have deserted the ranks last year. And last month, the Taliban penetrated Kabul itself, attacking a building run by the National Directorate of Security, which is responsible for much of the security in the capital, as the New Yorker’s Dexter Filkins has reported.

Some argue that 15 years is not enough. They point to South Korea and Germany and say that the United States should simply stay unendingly. I am not opposed to a longer-term U.S. presence in Afghanistan, especially because the country’s elected government seems to want it. But the analogy is misplaced. In Germany and South Korea, U.S. forces remained to deter a foreign threat. They were not engaged in a never-ending battle within the country to help the government gain control over its own people. The more appropriate analogue is Vietnam.

Much has been made recently of a pair of interviews on U.S. foreign policy, one with President Obama, the other with one of his closest aides, Ben Rhodes. Both men have been described as arrogant, self-serving and brimming with contempt for the foreign policy establishment. Certainly, as most administrations would, Obama and Rhodes sought to present their actions in a positive light. So Obama congratulates himself for stepping back from the edge of military intervention in Syria. He never grapples with the fact that his own careless rhetoric — about Bashar al-Assad’s fate and “red lines” — pushed Washington to the edge in the first place.

But on the most important issue of substance, Obama is right and his critics are wrong. The chief lesson for U.S. foreign policy from the past 15 years is that it is much easier to defeat a military opponent in the greater Middle East than to establish political order in these troubled lands.

The mantra persists in Washington that Obama has “overlearned” the lessons of Iraq. But the lessons come not just from Iraq. In Iraq, Afghanistan and Libya, it took weeks to defeat the old regime. Years later, despite different approaches, all of these countries remain in chaos. Can anyone seriously argue that a few more troops, or a slightly different strategy, would have created stability and peace?

The Obama administration’s policy is trying to battle the Islamic State and yet steer clear of anything that would lead it to occupy and control lands in the region. I worry that the United States is veering toward too much involvement, which will leave Washington holding the bag, but I understand the balance the administration is trying to strike.

In Syria, Washington’s real dilemma would be if the effort worked and the Islamic State were defeated. This would result in a collapse of authority in large swaths of Iraq and Syria that are teeming with radicalized Sunnis who refuse to accept the authority of Baghdad or Damascus. Having led the fight, Washington would be forced to assert control over the territory, set up prisons to house thousands of Islamic State fighters, and provide security and economic assistance for the population while fighting the inevitable insurgency.

You know you’re in trouble when success produces more problems than failure.

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