Are the days of American predominance in the Middle East coming to an end or is US influence simply taking a new shape? How far is Washington, after refusing to try to keep Hosni Mubarak in power in Egypt, facing the same situation as the Soviet Union in 1989, when the police states it had sustained in Eastern Europe were allowed to collapse?

The US is obviously weaker than it was between 1979, when the then Egyptian president, Anwar Sadat, signed the Camp David agreement and allied Egypt with the US, and 2004/05, when it became obvious to the outside world that the Iraq war was a disaster for America. At the time, General William Odom, a former head of the National Security Agency, the biggest US intelligence agency, rightly called it "the greatest strategic disaster in American history".

Since then, the verdict of the Iraq war has been confirmed in Afghanistan, where another vastly expensive US expeditionary force has failed to crush an insurgency. In the last few weeks alone, Taliban fighters have succeeded in storming Camp Bastion in Helmand province and destroying $200m worth of aircraft. So many American and allied soldiers have now been shot by Afghan soldiers and police that US advisers are under orders to wear full body armour when having tea with their local allies.

The Arab Spring uprisings posed a new threat to the US, but also opened up new options. Support for Mubarak was decisively withdrawn at an early stage, to the dismay of Saudi Arabia and Israel. But the Muslim Brotherhood had long been considering how it could reach an accommodation with the US that would safeguard it against military coups, and enable it to chop back the power of the Egyptian security forces. This was very much the successful strategy of the Turkish Prime Minister Recep Tayyip Erdogan and his Justice and Development (AKP) party, explaining why it was prepared to join the US in invading Iraq in 2003 and why it has become the chief instrument of American policy towards Syria in the past year.

This alliance with Islamic but democratic and pro-capitalist parties in Egypt and Turkey is obviously in the interests of the US and the Atlantic powers. But their support for democratic change in North Africa and West Asia is determined by self-interest. It does not, for instance, extend to Bahrain where the Sunni al-Khalifa monarchy has been busily locking up its Shia opponents and retreating from promises of meaningful reform. But new allies must at some point mean fresh policies. In sharp contrast to the Mubarak regime, a new government in Egypt is unlikely to support covertly Israeli military action such as the bombardment of Lebanon in 2006 and of Gaza in 2008.

A problem for the White House is that American voters have not taken on board the extent to which US influence has been reduced. For all the rhetoric about the Iraq war being a strategic disaster, the American political and military elite has also failed to appreciate the extent and consequences of failure. It is extraordinary to discover, according to recent revelations, that as late as 2010 Vice-President Joe Biden was under the impression that he could blithely decide who would be president of Iraq. Biden's grip on Iraqi geography appears to be as shaky as his understanding of its politics. On one occasion in Baghdad, he lauded all the good things the US had done for Baku, the capital of Azerbaijan, having apparently mistaken it for Basra in southern Iraq.

The killing of the US ambassador to Libya, Christopher Stevens, and the burning of the US Consulate in Benghazi could have been a worse political disaster for President Barack Obama than it turned out to be. It highlighted that the rebels who overthrew Muammar Gaddafi were not quite as they had been presented by the US government and media during the war past year. The US State Department appears to have had an unhealthy belief in its own propaganda, not seeing that its consulate in Benghazi was in one of the most dangerous places in the world. The assault did not come out of a blue sky. Fighters had shot at the convoy of the British ambassador, Sir Dominic Asquith, in Benghazi a few weeks earlier. In July last year, the rebels' own commander, Abdel Fatah Younis, was abducted and murdered by men nominally under his command in revenge for repressive actions he had carried out before he defected from Gaddafi's forces.

Diplomats and soldiers are often curiously blind to dangers facing them. It may be that both live in very inward-looking communities and somehow cannot internalise how somebody outside may think and act. I remember in 1983 in Lebanon talking to the highly intelligent US marine commander whose soldiers were based near Beirut airport. In theoretical terms, he could see very clearly that American forces had some very dangerous enemies and were vulnerable to attack, but he unaccountably failed to take effective measures that might have stopped a truck packed with explosives killing 241 marines when their base was destroyed. Likewise, the Green Zone in Baghdad from 2003 on had elaborate fortifications, but its outer defences were manned at one moment by former Peruvian policemen from Lima and, at another, by ex-soldiers from Uganda hired on the cheap by a security company.

A more effective political opponent than Mitt Romney could surely have inflicted damage on Obama over the Benghazi debacle. A measure of Romney's ineptitude is that he failed to do so and, instead of scoring points, he came across as opportunistic and ignorant. After all, Obama has been conducting a policy of retreat in Iraq, Afghanistan and Egypt without quite coming clean about it. Romney's denunciation of Obama for "apologising" for America was shallow demagoguery, though rhetoric on the American right should not be dismissed too casually. George W Bush's supporters used to spout similar nonsense, but only after 9/11 did it become appallingly clear that they believed a lot of what they were saying.

Supposing Obama is re-elected in November, will the US stance change at all? The endlessly repeated Israeli threats to launch air strikes on Iran have always struck me as being most likely highly successful bluff, since threats alone have served Israeli purposes so well, isolating Iran economically and diverting attention from the Palestinians.

More immediately, will the US move after the election, possibly acting through Turkey, to take military action to displace Bashar al-Assad in Syria? There is something deceptive about David Cameron implying that Russia and China are responsible for the slaughter of Syrian children.