Not for the first time, Western governments have been caught off-guard by a wave of popular protest in Muslim countries. Things started in Cairo with a grassroots assault on the US embassy. Then, in Libya, the attack on the US Mission in Benghazi on September 11, 2012, left four diplomats dead - including Ambassador Christopher Stevens.
Protestors in Tunis and the Yemeni capital Sanaa broke into embassy compounds. In Tunis, they set fire to the American school. Similarly, in Afghanistan, Indonesia, Iran, Iraq, Sudan, Malaysia and Nigeria, protestors rallied against the budget YouTube clip the Innocence of Muslims. Some protestors believe that its offensive portrayal of Prophet Muhammad is endorsed by the US government.
Most feel that such an anti-Muslim video is a natural product of the US' hedonistic culture and American support for Israel. In short, for many Muslims, the YouTube clip symbolises the US' corrosive influence on their lives and their culture.
Most Western media commentary has compared the current protests with the wildfire reactions to the Danish cartoons mocking Muhammad in early 2006, or the protests against Quran burnings over the last two years. There are striking parallels.
Similarly to the effect of the Innocence of Muslims, which was released on July 2, the publication of the Danish cartoons in late 2005 caused riots only months after they were printed. They led to the bombing of the Danish embassy in Pakistan. In Iran, Syria, and Lebanon, Danish embassies were set on fire.
The proclamation by an obscure Florida pastor, Reverend Terry Jones, of "International Burn a Quran Day" last year led to the storming of a UN mission in Afghanistan and the killing of seven UN workers. Yet, it is arguable that neither episode had a long-lasting impact on US foreign policy.
Embassy protests and the Iranian Revolution
Another parallel is perhaps more important: the protests and attacks on US embassies in the wake of the Iranian Revolution in 1979. The events in Iran rippled outward because the spread of television sets allowed more people around the world to know what was happening - this parallels the increased access to the internet and social media which have transformed Muslim societies in the last three years.
| Inside Story - Is the West ganging up on Muslims?
In November 1979, hundreds of Islamist students occupied the American embassy in Tehran. It was supposed to be a sit-in lasting a few days. The students were backed by the local police and Revolutionary Guards - but not by the government.
Reportedly, the initial reaction of the Supreme Leader, Ayatollah Khomeini, was to order the police to be sent in to "kick out" the students. But the takeover proved to be popular; Khomeini changed tack and the Iranian government took over the building.
As these events unfolded, they were broadcast to the world. To Muslims living under authoritarian US-backed regimes, the televised Iranian revolution overturning the Western-backed Shah seemed to be a forerunner of their own coming deliverance. In December 1979, for example, the US Embassy in Libya was set on fire and its documents were stolen.
The seizure of the US embassy in Tehran permanently scarred US-Iranian relations. The Iranian government held 52 American hostages for 444 days. The occupation of the embassy placed the US president, Jimmy Carter, in an impossible position. Although conservative critics often lambasted Carter for his "softness" towards Iran, he actually adopted a hardline policy.
Iranians living in the US were deported; oil exports from Iran were embargoed; and the US seized Iranian assets and bank accounts. Carter's policy ended in ignominy when he ultimately resorted to tough-guy politics: military action.
A misguided attempt to use Special Forces to rescue the hostages in Tehran went horribly wrong, ending in the loss of six aircraft and the death of eight servicemen. The American electorate kicked Carter out. Ronald Reagan came to power promising to "get tough" with Iran; so his administration backed the brutal dictator Saddam Hussein in the Iran-Iraq War in the 1980s - another disastrous intervention in the Middle East.
The Arab Spring as crisis and opportunity
Last year's Arab Spring ended decades of dictatorial rule in Tunisia, Egypt and Libya. After initial misgivings, the US and its Western allies supported - albeit on a selective basis - the revolutions against the authoritarian rule of their own former clients.
"Either [Obama] can tread carefully, using diplomacy and aid to keep his leverage with the new democracies of the region; or he can court popularity at home by giving in to calls for direct action."
Despite widespread distrust of US policy - primarily the legacy of decades of support for Israel and the wars in Iraq and Afghanistan - there was a window of opportunity whereby a new, more equal relationship between the US and Muslim countries could encourage regional stability and mark an end to the neo-con adventurism of the Bush years.
But the current crisis threatens to dash these hopes. Like Ayatollah Khomeini in 1979, leaders of the new Islamist regimes in the region have to cater to the whims of their supporters to preserve their legitimacy. Sooner or later, they may choose to ride the wave of anti-US feeling by caving in to populist gestures - such as permitting the occupation of an American embassy.
Like Jimmy Carter, President Obama faces an unenviable choice. Either he can tread carefully, using diplomacy and aid to keep his leverage with the new democracies of the region; or he can court popularity at home by giving in to calls for direct action. The signs are not encouraging.
The Republican challenger Mitt Romney has already denounced Obama for his "weak" response. Congressmen have called for the cancellation of US aid to Egypt and Libya. Obama has now ordered very public deployments of warships off the Libyan coast and US Marines to Yemen. Meanwhile, although more diplomatic and humanitarian engagement is needed, the State Department has called on all US citizens to leave Tunisia and Sudan.
We can only hope that, despite the pressures of an election year, President Obama will recognise that the long-term interests of the US lie in building constructive relations with the new democracies of North Africa. Knee-jerk reactions such as withdrawing US citizens, or lashing out in revenge, would threaten to undermine all the positive potential that the Arab Spring holds for changing the US position in the Middle East.
Jason Pack is a researcher of Middle Eastern History at the University of Cambridge. He is president of Libya-Analysis.com.
James Roslington is a PhD candidate in North African History at the University of Cambridge.
The views expressed in this article are the authors' own and do not necessarily reflect Al Jazeera's editorial policy.