The United States has adopted the mission of “global security provider,” according to the most recent Defense Department quadrennial strategy statement. This is a self-nominated role as custodian of a (prospective) global order based on American democracy and capitalism, meant to replace the Westphalian system of absolute national sovereignties and the tradition and institutions of international law as these used to be observed (before the arrival of George W. Bush, Dick Cheney and, regrettably, Barack Obama).

This is what the U.S. has seen itself doing since the first Gulf War (the Kuwait war) in Iraq, Afghanistan, Yemen and elsewhere in the Islamic world. The mission has led successive American governments into invasions, wars and policies of global intervention, justified by reformist aims.

Not all of the world — certainly not the Islamic world — wants America’s version of global security, which has required repeated American military interventions abroad, provoking guerrilla and terrorist resistance. The existence of this reciprocal cause/effect phenomenon has been widely ignored in Washington, but the consequences have ranged from damaging to disastrous.

American troops are now scheduled to leave Afghanistan, after failing to defeat the Taliban insurrection. President Barack Obama last year announced their withdrawal in 2014. Or he announced more or less their withdrawal — except for those who stay.

We went through this during the past two years with Iraq, where a U.S. withdrawal was announced, followed by Washington’s attempt to negotiate with the Baghdad government about how many American soldiers would actually stay on. Just to train troops, the U.S. said. And to deal with terrorism, if there was more of that (as, surprisingly enough, there has been). In general, to “provide security,” since Iran might make trouble, or if the permanence of the boundary with Kurdish-controlled territory were to come into question, making trouble. A question also existed about the long-term security of the oil sector and its exports.

And there might be internal Shiite-Sunni difficulties (as indeed there have been). How could Iraq manage without having some Americans to call on if necessary? And finally, the U.S. had spent all that money on building bases and air facilities, and the biggest U.S. embassy in the world (bigger than the Vatican City), so as to have a strategic base, just in case there was some future trouble. The newly democratic Iraqi parliament and government said, “Thank you, but no.”

The United States could have refused to take no for an answer. But the American public wasn’t likely to want to fight over this. The whole rationale for eight years in Iraq was to liberate the Iraqis from their homegrown tyranny. And President Obama had promised that the Iraq war would end.

Now there is the same problem with Afghanistan. American forces have been in the country in one or another way since 2001. After the 9/11 attacks, committed by the Afghanistan-based al-Qaida, the Pentagon sent B-52s to obliterate the Taliban government army, overturned the Taliban (Pashtun) government, and sponsored creation of a new and friendly government dominated by the two main ethnic minorities, the Tajiks and Hazaras, with a presumably tame and symbolic Pashtun president, Hamid Karzai.

President Obama, following his 2008 election, was assured by the U.S. generals in command that they had the war against the Taliban all but wrapped up, provided that he did what they told him to do. He did — but they didn’t.

The president has now ordered home the American troops in Afghanistan. This presumes that an all-Afghan settlement will be negotiated, or that Afghanistan’s army and police will defeat the insurrection, which no one believes. (The Pentagon concedes that only one of 23 NATO-trained Afghan brigades currently are capable of functioning on their own.)

However, in order to spare reputations at best, or at worst to obfuscate humiliation, the Pentagon wishes to keep a substantial residual force in Afghanistan after 2014. It originally proposed 20,000 men and women, but according to The New York Times, it may be forced by the White House to settle for much less.

Unlike in Iraq, President Karzai of Afghanistan wants a large American residual force. When the Americans go, he (if he has survived) or his successor will head a Tajik-Hazaras minority government confronting a Pashtun population numbering some 40 percent of the total population. He will discuss this problem with Obama when the two meet this week. The last time they met, in May 2011, they signed a “strategic partnership agreement.”

But why does Washington want to stay? Do the foreign policy officials in office not understand that for American troops to stay in Afghanistan to “provide security” is to assure insecurity, since the presence of infidel soldiers inspires hostility and resistance?

Visit William Pfaff’s website for more on his latest book, “The Irony of Manifest Destiny: The Tragedy of America’s Foreign Policy” (Walker & Co., $25), at www.williampfaff.com.