Iranian officials are carefully weighing their options after the surprisingly swift Taliban takeover of Afghanistan amid fears of instability, a refugee influx, and extremist groups such as Islamic State (IS) gaining a permanent foothold in its eastern neighbor.
Tehran, which has cultivated loose ties with the Taliban in recent years and hosted the group's representatives, has not publicly reached out to the militants since they seized much of Afghanistan within a week and triumphantly took control of Kabul on August 15.
In brief comments issued after the fall of the Afghan capital, new Iranian President Ebrahim Raisi and outgoing Foreign Minister Mohammad Javad Zarif did not directly mention the Taliban.
"The military defeat and the U.S. withdrawal from Afghanistan should offer an opportunity to restore life, security, and lasting peace in that country," Raisi, whose inauguration ceremony was attended by Afghan President Ashraf Ghani, was quoted as having said to Zarif on August 16.
Hours earlier, Zarif tweeted that "violence & war -- like occupation -- never solve problems." He added that Iran welcomes an announcement by former Afghan President Hamid Karzai on the formation of a "coordination council by Afghan leaders."
He concluded the August 15 tweet saying that Iranians hope "it can lead to dialogue and a peaceful transition in Afghanistan. Iran stands ready to continue its peacemaking efforts."
Analysts say Iran is mulling how best to secure its interests in its western neighbor as Tehran has been playing a balancing act by providing public support to the Afghan government while also developing ties with the Taliban.
Iran has previously described the militant Islamist group as "part of today's reality of Afghanistan" and said it must be "part of the future solution" in the war-torn country.
Afghanistan In Turmoil: Full Coverage On Gandhara
Read RFE/RL's Gandhara website for complete coverage of developments in Afghanistan. Gandhara is the go-to source for English-language reporting by RFE/RL's Radio Azadi and its network of journalists, and by RFE/RL's Radio Mashaal, which offers extensive coverage of Pakistan's remote tribal regions.
"The Iranian leadership has put a brave face on. It has celebrated the U.S. withdrawal as a victory for the Afghan people, which by implication offers an endorsement for the Taliban," Shahram Akbarzadeh, a professor of Middle East and Central Asian politics at Australia's Deakin University, told RFE/RL.
Akbarzadeh added that Tehran is hoping for "professional if not cordial ties" with Afghanistan's future government amid worries that the Taliban would be anti-Shi'a, persecute the Hazara minority, and adopt anti-Iran policies.
"This would be extremely concerning for Iran. From the geostrategic point of view, this would facilitate Saudi influence in Afghanistan. An anti-Shi'a and anti-Iran government in Afghanistan could present serious security challenges for Iran and make Afghan territory a haven for anti-Iran terror groups," he said.
A Tehran-based observer who requested anonymity said Iran is finding a balance between "its anti-American stance and preserving its national interests, including security" on its borders.
'Most Negative Consequences'
Iran's former charge d'affaires in Afghanistan, Abdolmohammad Taheri, was quoted by the official government news agency IRNA as saying on August 18 that his country has the "authority" as well as the experience with various groups in Afghanistan to pressure the Taliban to prevent more suffering for the Afghan people while also keeping Iran safe.
Taheri described the withdrawal of U.S forces from Afghanistan as a "betrayal" that paved the way for the Taliban's lightning advances. He added that Tehran would face the "most negative consequences" of the upheaval, including an influx of refugees that he said could include members of IS and the terrorist group Al-Qaeda.
Iran, which shares a 900-kilometer border with Afghanistan, already hosts more than 3 million Afghans, according to the United Nations refugee agency.
Taheri said Iran cannot tolerate an enemy such as the United States in its vicinity while also warning that the Taliban and the Islamic republic do not share an "affinity" for one another.
The two sworn enemies have forged ties in recent years despite the 1998 killing of seven Iranian diplomats and a journalist in the northern Afghan city of Mazar-e Sharif after it was overrun by Taliban militants.
There are also reports that Iran has sent arms to the Taliban during its long war against government forces, an accusation that Tehran denies.
Iran's Foreign Ministry called on the Taliban to ensure the safety of Iranian staff at the consulate in Herat after the group seized the western Afghan city on August 13.
Tehran said on August 17 that the staff of three of out of its five missions in Afghanistan are working from Kabul while adding that the number of staff has been drastically reduced.
But Iran said on August 17 that it is one of four countries still operating at their embassies in Kabul (Russia, China, and Pakistan are the others).
Inside Iran, many have been watching the Taliban takeover with great concern. Some of the Afghans living in Iran have staged protests in Tehran, Isfahan, and Qom in which some chanted "Death to the Taliban."
The Taliban's rule from 1996 to 2001 was marked by horrific atrocities and serious human rights violations, including the deprivation of women's most basic rights.
Amid the concerns, Sunni religious leader Molavi Abdol Hamid created controversy by praising "the Taliban's impressive" seizure of Afghanistan, claiming that the group's views have changed in the past 20 years.
"They have gained experience and their views have changed and if there are shortcomings they can be amended," Abdol Hamid, the Friday Prayers leader of the southeastern city of Zahedan in the Sistan-Baluchistan Province, said on August 17.
Other clerics, including Grand Ayatollah Safi Golpayegani, have warned in past weeks that the Taliban should not be trusted.
"It would be a grave, irreparable error to trust" the Taliban, which has "a history of evilness and murder," said Golpayegani in July.
Meanwhile, Ayatollah Asadollah Bayat Zanjani warned earlier this month against those attempting to whitewash the policies of the Taliban, which he described as "violent, radical, and terrorist."