While the United States watches events in Egypt with concern, officials in Tehran view the continued unrest with undisguised satisfaction.
From Iran's point of view, whatever eventually emerges from the protests has to be better than the government that preceded it.
Gen. Hossein Salami, the deputy commander of the Iranian Revolutionary Guards, expressed delight at recent developments, saying, "Egypt is the heart of the Arab world, and now it is the heart of political and social change and of revolution in the Arab world."
Iran's official Fars news agency has urged the Egyptian authorities "not to allow military or security forces to resort to violence in dealing with this popular wave."
It was an ironic request, coming from a news agency known to have close ties with the Revolutionary Guards, which, in turn, played a key role in cracking down on popular protests following President Mahmoud Ahmadinejad's controversial reelection in 2009.
In fact, both the Iranian government and its opposition have attempted to spin the unrest in Egypt to their own advantage.
The government portrays the uprising as evidence of the influence of its own 1979 Islamic revolution.
Opposition leader Mir-Hossein Mousavi, on the other hand, contends that the protests are modeled on the Green-Movement demonstrations that followed the presidential election in 2009.
And unlike authoritarian leaders in neighboring Arab counties who view the prospect of reform and democracy with dread, Tehran is unconcerned by the consequences of a democratic revolt aboard.
That is because almost any kind of regime change in Egypt is likely to produce leaderships that are less hostile to Iran than the current one.
Iran also believes that democratic movements will offer it new avenues to build influence in these countries. After all, the government of Egyptian President Hosni Mubarak has long been a stalwart supporter of the United States.
In fact, Iran has fewer problems with regional states that have a semblance of democracy than with those ruled by autocrats. Islamists rose to power through elections in Turkey and relations have never been better. In Iraq, Tehran now has friends in high places in the shape of an elected president and prime minister.
Non-democratic states, on the other hand, pose direct threats to Iran. For example, WikiLeaks cables reveal the leaders of Saudi Arabia, Bahrain, the United Arab Emirates and Jordan all urging the United States to take military action against Iran in order to block its nuclear development.
In fact, whether it's the Muslim Brotherhood or a secularist like Nobel Peace Prize winner Mohamed ElBaradei who succeeds Mubarak, Iran feels it can't lose. After all, it was ElBaradei who, as head of the International Atomic Energy Agency, held out against U.S. pressure to accuse Iran of shifting its nuclear program to weapons production.
comment on this story
It nothing else, Mubarak's departure will almost certainly be followed by the reopening of the Iranian embassy in Cairo after a 32-year absence.
So it's no surprise that Tehran feels well positioned to gain politically in the region come what may.
"The new Middle East is taking shape," wrote Hossein Shariatmadari, the editor-in-chief of the hard line daily Kayhan. "Contrary to (ex-U.S. president George) Bush's wishes, it is being formed with Iran at the center."
Ali Reza Eshraghi is the Iran Program editor for The Institute for War & Peace Reporting, a nonprofit organization that trains journalists in areas of conflict.