Why Assad's fall would diminish Iran's power
When the Arab Spring began in early 2011, Iran's government declared that it was happy with what it was seeing.
The people of the Middle East, it announced, were following the example set by Iran in 1979 when Ayatollah Khomeini overthrew the Shah.
But that happiness has given way to anxiety as Iran sees its only reliable ally in the region struggle to stay in power.
Iran and Syria are unlikely partners. Iran is a theocracy, Syria is a secular state. One country is Persian, the other Arab.
But after the 1979 Islamic Revolution in Iran, the two countries found that they had considerable mutual interests.
They needed to come together to fight their common rival, Saddam Hussein of Iraq. They also allied in order to check Israeli advances into Lebanon and to prevent any American attempts to enter the Middle East.
Each provided support to the Lebanese armed movement Hezbollah and to the Palestinian armed groups Hamas and Islamic Jihad.
Syria has consistently provided Iran with an element of strategic depth. It gives Iran access to the Mediterranean and a supply line to Iran's Shia Muslim supporters in southern Lebanon next to the border with Israel.'Western plot'
In other words, Iran's alliance with Syria gives Tehran the ability to project its power right up to the Israeli border.
End Quote Ali Akbar Salehi Iranian Foreign Minister
It is necessary that pro-Syrian countries pave the way for talks between the government and the opposition to find a solution”
Losing this ability to project its power via Syria would represent a strong blow to Iran. This helps to explain why Iran's government has supported President Bashar al-Assad in Syria's conflict with rebel forces.
In addition, the two governments share a common view of the world. In particular, they appear to view any opposition to their respective administrations as a Western-inspired plot.
"The essence of the Islamic Awakening in the region is anti-Zionist and anti-US," said Iran's Supreme Leader Ayatollah Ali Khamenei in June 2011. "But in the case of Syria, US and Israeli hands are evidently at work."
The United States accuses Iran of providing direct assistance to President Assad's government.
Officials say that Iran has sent advisers to Syria and has provided riot gear and surveillance equipment to Syrian security forces. Iran has denied the allegations.
"The allegations levelled at our country are aimed at pushing the atmosphere inside Syria towards chaos, and we do not find such measures and comments to be right," said Iranian foreign ministry spokesman Ramin Mehmanparast in February 2012.Peace broker
Iran appears to be determined to continue supporting Syria. But, in recent months it has also begun to cast an eye to a future in which it may have to do without its main ally.
It is even seeking a role for itself as a peace broker.
"The Islamic Republic of Iran is ready to sit down with the Syrian opposition and invite them to Iran," said Foreign Minister Ali Akbar Salehi on 15 July. "We are ready to facilitate and provide the conditions for talks between the opposition and government."
Mr Salehi continues to advance this position.
"It is necessary that countries that are pro-Syria and support peace and stability in the region pave the way for talks between the government and the opposition in order to find a solution to the situation," Iran's Isna news agency reported Mr Salehi as saying on 31 July.
If Iran loses Syria, it will struggle to find a comparable replacement.
The Islamic Republic maintains an alliance with the Shia-led government of its neighbour, Iraq.
But Iraq provides few of the geographical benefits of the alliance with Syria. In addition, the country is still recovering from its decade of conflict.New ally?
So Iran has to look elsewhere as well. The Islamic Republic is trying to mend a 30-year breach with the most populated country in the Middle East, Egypt.
But this won't be easy. Egypt's newly-elected President Mohammed Mursi comes from the Muslim Brotherhood movement.
The Brotherhood's allies have consistently fought against the Syrian government - on the opposite side of Iran.
Iran's semi-official Fars news agency may even have tried to give its own nudge to Iran-Egypt ties.
Shortly after Mr Mursi's election, Fars published what it described as an exclusive interview with the new president.
In the interview Fars quoted Mr Mursi as saying that Iran and Egypt should improve their ties. But the new president's office said that the interview was a complete fabrication.
Iran may have to find new ways of making friends.