(CNN) -- While some governments are trying to walk a fine line between supporting Egypt's president and supporting protesters in that tumultuous nation, Iranian officials are taking the side of the protesters.
But an Iranian opposition leader is making a competing claim of solidarity with the demonstrators, pointing out that when Iran's leaders faced a similar movement in their own backyard two years ago, they crushed it.
Iranian Foreign Minister Ali Akbar Salehi on Sunday praised Egypt's protests, according to Iran's semi-official Fars news agency, as did the speaker of Iran's parliament, who said the parliament and the nation support uprisings against dictatorial regimes.
"The time has [been] reached to overcome puppet autocratic regimes by relying on the Islamic teachings," said speaker Ali Larijani, according to the news agency.
And Ayatollah Ahmad Khatami, a top cleric in Tehran, was quoted last week by Fars as saying, "An Islamic Middle East is being created based on Islam, religion, and democracy with prevailing religious principals."
But Iranian opposition leader Mir Hossein Mousavi says that his 2009 mass protest movement, which was violently crushed in the streets of Tehran, was based on the same grievances as the ones now seen in Tunisia, Egypt, and Yemen.
"Today, the slogan of 'Where is my vote?' of the people of Iran has reached Egypt," Mousavi wrote on his website. And in the Egyptian government's confrontations and clashes with protesters, he says, "We can identify a similar pattern" to the crackdown by the Iranian government in 2009.
With Iran's regime and Iran's opposition both trying to identify with Egypt's protesters, "there are two competing narratives," says Afshin Molavi of the Washington-based New America Foundation, which describes itself as a nonprofit, nonpartisan public policy institute.
Analysts say Iran's leaders have a strategic interest at stake in the turmoil in Egypt: It is weakening Iranian leaders' biggest archrival in the region -- the secular, pro-Western Hosni Mubarak.
Mubarak has been an ally of the West for decades, taking the opposite position from Iran on a number of issues -- opposing Iran's nuclear program, supporting peace with Israel, and working to prevent border smuggling of weapons to Hamas militants in Gaza, according to American diplomatic cables released recently by WikiLeaks.
"Egypt is a significant adversary of Iran's in the region," says Molavi. In the rivalry for influence over the Middle East, he said, "The fall of the Mubarak regime would be of geostrategic benefit for Iran."
Iran's Islamic leaders, including Ayatollah Khatami, may also be anticipating a bigger role for Islam emerging in governments in the region, according to Marc Ginsberg, former U.S. ambassador to Morocco.
"There's nothing that Iran wants more than instability in the Middle East, particularly among the autocratic leaders. They hope that eventually these leaders will have to give way to more Islamist-oriented political establishments no longer aligned with the United States," he said.
Could the unrest also allow Iran to seek to gain influence within Egypt itself?
Even before the protests began, Mubarak reportedly believed such an effort was already under way. According to an American cable dated April 19, 2009, "Mubarak and his advisors are now convinced that Tehran is working to weaken Egypt through creation of Hizbollah cells, support of the Muslim Brotherhood, and destabilization of Gaza."
But CNN national security analyst Peter Bergen said he does not see evidence of Iranian influence in Egypt's largest opposition movement.
"I'm not sure that Iran has much of a foothold in Egypt through the Muslim Brotherhood," he said, referring to Egypt's largest opposition bloc.
He also pointed out that Iran may have trouble making inroads in a country that is mostly Sunni, when the Iranian regime is Shia.
And even if Mubarak were replaced, he said, the two countries would likely still be at odds on some key issues. "I think any Egyptian regime is going to take a very skeptical view of Iran's nuclear quest," he said.
CNN's Tim Lister contributed to this report.