At first glance it looked as though President Mahmoud Ahmadinejad's government in Iran would be happy with the revolutions in Tunisia and Egypt, as two long-term American allies were removed from the scene, and with what was increasing strife in Bahrain as protesters appeared to make initial headway with their demands for a dialogue with the government. But events are moving too fast for such a quick judgment, and now Iran looks as though it has more to worry about in the Arab world than to be pleased with.
Despite the departure from power of American friends like Hosni Mubarak in Egypt and Zine Abidine Bin Ali in Tunisia, the new governments are very unlikely to support Iran's view of the world.
For some years what is described by Dalia Dassa Kaye as "Iran's populist, anti-American, direct outreach to Arab publics" has allowed Ahmadinejad to build a popular legitimacy with the Arab peoples independent of what their governments' determination might have been to follow whatever Washington requested.
But this appeal became much less attractive when people took matters into their own hands, and toppled governments with action based on a secular agenda. The people of Egypt and Tunisia have found that they do not need Iranian support to change their fate. They have found their own ways to fight corrupt regimes and managed to do so without resorting to violence.
Events in Bahrain have also shifted dramatically. A few weeks ago the protesters were starting to gather widespread support as they sought a dialogue with the government, but after the hardliners took over and shifted the protesters' demands to calling for regime change, the protests lost a wide section of support and became more marginalised to the radical minority.
Iran is seeking to put a brave face on events by indicating its support for the Shiite element in the protests, but strong action by the government and its Gulf Cooperation Council allies has clamped down on the movement, making any change unlikely in the near future.
Iran has also seemed confused by events in Libya. Initially, Tehran voiced its support for the uprising against Muamar Gaddafi, describing it as part of an "Islamic awakening" in the Arab world. But this changed after the coalition forces launched their air strikes against Libyan troops, when Tehran said that their aim was to gain neo-colonial control over the oil-rich nation.
Desperation
The Iranian Foreign Ministry has urged Libyans to be wary of an eventual occupation by western countries which are claiming to protect them, adding that Iran wants to "support the Libyan people and defend their legitimate demands", which are bizarrely similar to the claims being made by the French and British.
The powerful message of change, thanks to the uprisings in Tunisia and Egypt, has rippled across the whole of the Arab world, but it has also hit home in Iran where the struggling Green Movement has been revitalised by what has happened in Cairo and Tunis.
Despite appearing to have collapsed after a high point during the massive unrest following Tehran's disputed presidential election in 2009, the Iranian opposition is still there, waiting for a chance. And even if many of its leaders are in jail, the opposition is putting Ahmadinejad under a lot more pressure than seemed likely even a few just weeks ago.
Ahmadinejad is well aware of the need to prepare for a new onslaught. One example is how he has got former [president Akbar Hashemi Rafsanjani removed from his important post as chairman of the Assembly of Experts, giving way to a much more conservative ayatollah, Mohammad Reza Mahdavi Kani.
Rafsanjani refused to take a clear position against the Green Movement which infuriated Ahmadinejad. The Assembly of Experts appoints and dismisses the supreme leader, the most powerful position in Iran, who is Ahmadinejad's mentor, Ayatollah Ali Khamenei.
Clearly, to have Rafsanjani's continual support for a more open political system and the need to redress some of the issues that prompted post-election protests, could hurt Ahmadinejad.
In addition, if a new wave of protests was to break out in Iran, Obama's administration could feel that it had to support the marchers. In 2009 it feared that any support would de-legitimise the Green Movement, but after Egypt and Tunisia, Washington might take a different view. Its efforts to engage with Ahmadinejad's regime are failing, and the talks in Geneva going nowhere.
The likely new leaders in Egypt and Tunisia, and maybe Libya, will base their view of the Arab world on a far more liberal outlook than has been the case to date. They will be looking for action on reforms, human rights and freedoms, and will find it easy to join action based on those criteria.
This may allow Washington to rebuild a much stronger anti-Iranian alliance among the Arab states, particularly since the old one was never that strong anyway, as many Arab states simply wanted to find a way to get along with Iran.