NEW YORK — As decades of U.S.-backed “stability” unravel in the Mideast, the American dilemma is coming to a head in the Gulf.

Pivoting on Egypt and Tunisia required a delicate diplomatic dance for Washington and bombing the maniacal regime of Libyan leader Muammar Gaddafi was a relatively easy call. But now the Obama administration faces a moment of truth as unrest threatens to topple friendly despots in the oil-rich, terror-tolerant Persian Gulf.

The tacit U.S. backing for the crackdowns in Bahrain and Yemen has put the U.S. in a contradictory position, siding with “pro-democracy” movements in North Africa while choosing to back anti-democratic monarchs and presidents-for-life in the Gulf. The governments in question have used violence, though as yet not on a Libyan scale, yet both look as if they are losing their struggle for survival.

For Washington, the options on the table look rather grim. Whatever public contradictions exist, no U.S. government can suddenly pivot to become a cheerleader for the overthrow of the House of Saud knowing the consequences most certainly would include a historic oil price spike and a new dive into a global recession.

Furthermore, just who might replace the Saudi monarchy is a much more difficult question in Saudi Arabia than in Egypt or Libya. The world can and has lived with difficult regimes in Tripoli and Cairo. In Riyadh, given the extent of local sympathy for Al Qaeda (expressed in financial support) and the deeply, medieval intolerance of its culture, the devil we know may truly be better than the one we haven’t yet met.

Another problem, of course, is Iran. The angry Shia majority in Bahrain, ruled for decades by a Sunni monarchy, by and large has its own good reasons to be unhappy with the island’s domestic politics. But the Saudi intervention last week, opposed by Washington, is a disastrous turn of events for the United States, which will invite Iran into the conflict in ways which had previously been impossible.

At the very least, Iran’s concern for the rights of Bahrain’s majority Shias (and for minority Shiite communities in Yemen and Saudi Arabia’s own Eastern Provinces) now focuses attention on these internal injustices. In one moment of paranoia, the Saudis have undone decades during which they successfully kept Iran at arms-length and placed the Mullahs, in spite of what they do to their own domestic dissidents, on the right side of history.

The stakes are quite different in Yemen, the poorest of Arab countries and one where tribal divisions, a weak central government and Islamic militancy have led the United States to partner with another dictatorial regime. Counter-terrorism policy toward Yemen has, over the years, brought us the 2000 attack on the USS Cole, 2002 drone strikes against Al Qaeda leaders and frequent arrests by the government of Yemen’s president, Ali Abdullah Saleh, of suspects wanted by Washington in alleged plots to attack America and its allies.

Saudi Arabia, too, has frequently intervened here along Yemen’s lawless northern border, where Shia minorities and a local Al Qaeda affiliate both have stirred trouble in the kingdom. In 2009, Saudi airstrikes and artillery bombardments on behalf of the Yemeni government helped end one recent uprising by the northern Shia tribes of Yemen.

The unfortunate byproduct of American backing in the Middle East is that governments who are armed, financed and allied with Washington have felt virtually no pressure to deal with domestic political reform. Modest elements of democracy experimented with by some U.S. allies in the region — parliaments in Jordan, Morocco and Kuwait, for instance — resulted from local initiatives of monarchs, not because America demanded it.

Now, the price of shelving our values in pursuit of such stability — both in oil prices, and in the tacit security bought for Israel — is coming home to roost. Once again, U.S. President Barack Obama finds himself dealing with the results of a mess decades in the making and taking fire from some of the very Washington insiders who engineered this disaster.

As he ponders exactly how closely these “moderate Arab regimes” resemble the murderers of Tiananmen Square before Washington cuts its losses, you can only feel for the man — and hope his decisions put the United States on the right side of history without precipitating a historic economic disaster.