Nato is, after all, supposed to be training up Afghan troops to take control in time for the withdrawal of combat forces in 2014. Instead, those client regime troops are routinely turning their guns on a long-reviled foreign occupation force. No wonder support for a continued military presence is falling rapidly in the main British political parties – long after it has among the populations of all the occupying states.

The US-British invasion of Afghanistan was of course launched in response to the 9/11 attacks: the poison fruit of US-led support for the Afghan mujahideen war against the Soviet Union. Why do they hate us, many Americans asked at the time, oblivious to their country's role in decades of coups, tyranny, sanctions regimes and occupations across the Middle East.

She was referring to Nato's decisive role in winning power for the Libyan rebels who first took up arms in Benghazi last year. But just as the mujahideen the US backed in Afghanistan later turned their guns on their imperial sponsor in the form of the Taliban and al-Qaida, so many of the Islamists and jihadists who fought against Gaddafi with Nato air cover have their own ideas for the future of their country.

This is the start of the blowback from US and western attempts to commandeer the Arab uprisings. Something similar is likely to happen in Syria. The invasion of Afghanistan more than a decade ago not only didn't destroy al-Qaida, it spread it into Pakistan, Iraq, Yemen and north Africa, and today the flags of its offshoots are flying across the Arab world.

In Libya, Nato's intervention sharply escalated the death toll, triggered large-scale ethnic cleansing, spread war to Mali, and left thousands in jail without trial and the country in the control of multiple armed militias. Western governments hailed July's elections, in which most seats were not open to political parties, as bucking the Islamist trend across the region.

But their man, a former Gaddafi minister, has now been defeated for the job of prime minister by an independent Islamist, while the British ambassador's convoy, the Red Cross and UN have been attacked and Sufi shrines destroyed. Meanwhile, the Nato-backed authorities are threatening military action against jihadists in Benghazi, as American warships and drones patrol Libya's coast and skies.

The fact that the attack on the US consulate, along with often violent protests that have spread across 20 countries, was apparently triggered by an obscure online video trailer concocted by US-based Christian fundamentalists and émigré Copts – even one portraying the prophet Muhammad as a fraud and paedophile – seems bafflingly disproportionate to outsiders.

But in the wake of the Rushdie affair and Danish cartoons controversy, it should be clear that insults to Muhammad are widely seen by Muslims as an attack on their collective identity and, as the Berkeley-based anthropologist Saba Mahmoud argues, a particular form of religiosity that elevates him as an ideal exemplar.

Those feelings can obviously be exploited, as they have been in recent days in a battle for political influence between fundamentalist Salafists, mainstream Islamists and the Shia Hezbollah. But it would be absurd not to recognise that the scale of the response isn't just about a repulsive video, or even reverence for the prophet. As is obvious from the slogans and targets, what set these protests alight is the fact that the injury to Muslims is seen once again to come from an arrogant hyperpower that has invaded, subjugated and humiliated the Arab and Muslim world for decades.

Since launching the war on terror, the US and its allies have attacked and occupied Afghanistan and Iraq; bombed Libya; killed thousands in drone attacks in Pakistan, Yemen and Somalia; imposed devastating sanctions; backed Israel's occupation and dispossession of the Palestinians to the hilt; carried out large-scale torture, kidnapping and internment without trial; maintained multiple bases to protect client dictatorships throughout the region; and now threaten Iran with another act of illegal war.

The video is manifestly only the latest trigger for a deep popular anger in a region where opposition to imperial domination is now channelled mainly through the politics of Islam rather than nationalism. The idea that Arab and Muslim hostility to the US would have been assuaged because it intervened to commandeer Libya's uprising (an intervention most Arabs reject) is absurd.

About two-thirds of people in the Middle East and North Africa say they distrust the US, polling shows, rising to more than three-quarters in Pakistan. After 11 years of the war on terror, following decades of baleful intervention, the only surprise is that there aren't more violent anti-US and anti-western protests in the region.

Western war in the Muslim world has also fed a toxic tide of Islamophobia in Europe and the US. What is it about Muslims that makes them so easily offended, Europeans and Americans commonly demand to know – while Muslims point to cases such as the British 19-year-old who wasconvicted in Yorkshire last week of posting a "grossly offensive" Facebook message that British soldiers in Afghanistan "should die and go to hell", and ask why they're not afforded that protection.

The events of the last week are a reminder that an Arab world which has thrown off dictatorship will be more difficult for the western powers to hold in thrall. The Economist called the deadly assault on the US consulate in Libya an example of "Arab dysfunction" and urged the US not to retreat from the Middle East but go in deeper, including in Syria. As Afghanistan, Iraq, Pakistan and Libya have already shown, that would only bring disaster.