Iran is hosting high-level talks between Afghanistan's government and the Taliban, Iran’s Foreign Minister Javad Zarif said on Wednesday.
The negotiations come as a Taliban offensive took control of more districts, sending thousands of civilians fleeing with whatever belongings they could find.
The Ministry of Defence said the army was "defending Afghanistan with all their might".
Fighting has been raging around Qala-i-Naw, the capital of north-western Badghis province and the latest city to be surrounded by the insurgents.
The Foundation for the Defence of Democracies, a think tank in the US, said the Taliban forces now controlled 188 of the country’s 407 districts.
Mr Zarif will soon leave office, with Hassan Rouhani set to be replaced as president by Ebrahim Raisi, a close ally of Iranian supreme leader Ayatollah Ali Khamenei.
"Iran is ready to assist the dialogue process between the existing factions in Afghanistan to resolve the current conflicts and crises in that country," Iranian state media quoted Mr Zarif as saying.
In January, Iran held talks with Taliban representatives in Tehran. Iranian state news agency Irna said the deputy head of the Taliban's political office, Sher Stanekzai, and Afghan government representatives attended the latest Tehran meeting.
Mr Stanekzai has spent decades representing the Taliban abroad, serving as deputy foreign minister between 1996 and 2001 during the Afghan civil war.
After holding various roles governing areas under de facto Taliban control during the group's insurgency against the Afghan government, Mr Stanekzai led faltering peace negotiations in Qatar from 2012 onwards, rising to the role of the group's official political representative in Qatar, from where he travelled to attend the talks.
On the Afghan side, former vice president Younus Qanooni represented the government along with members of the High Council for National Reconciliation.
Mr Stanekzai and Mr Qanooni fought against the Soviet invasion of Afghanistan in the 1980s, in different factions of the Afghan Mujahideen.
Mr Qanooni is from the Tajik ethnic minority and fought alongside Ahmad Shah Massoud, who became a folk hero of resistance against the Soviets in northern Afghanistan before he was assassinated by Al Qaeda in 2001.
After the Soviet departure from Afghanistan in 1989 the country descended into a bitter civil war, with Mr Qanooni and Mr Stanekzai on opposing sides.
Mr Stanekzai and fellow fighters in the Taliban gained the upper hand until the international invasion in 2001.
The US says the Taliban have failed to respect a peace deal with Washington that was agreed to in February last year.
Violence has surged across Afghanistan despite the deal and the army is struggling to hold its ground against one of the largest Taliban offensives to date.
Taliban assassinations of Afghan government figures and civil society activists have increased in recent years.
The Taliban have also been accused of increasing its co-operation with Tahrik-e-Taliban, the Pakistani wing of the insurgency group.
Historically, Iran is opposed to the Taliban, supporting opposition groups in northern Afghanistan during the country's civil war in the 1990s.
Iran co-ordinated with the US in the lead up to the 2001 international invasion of Afghanistan to oust the militant group, former US diplomat Ryan Crocker said.
US forces and international allies invaded Afghanistan after 9/11. The movement refused to hand over Osama bin Laden, who was being sheltered by the Taliban along with a large following of Al Qaeda terrorists.
As the US presence in Afghanistan grew, Iran stood accused of helping the Taliban to disrupt the American presence on its western border, a 2014 report by US defence think tank Rand found.
More recently, Iran created a proxy Afghan Shiite militia force, the Fatemiyoun Army, which fought in Syria.
The US has been withdrawing its troops from Afghanistan, leaving behind a large diplomatic presence at the embassy in Kabul. The last US forces left Bagram airbase on Friday in the middle of the night without informing their Afghan allies.
Afghan soldiers at the scene called the lack of notification an insult but a senior Afghan general told AFP it was time for the military "to secure our country and once again build our country with our own hands”.
Afghan Defence Minister Bismillah Mohammadi said the war was entering a difficult stage.
Negotiations between Afghan government and Taliban negotiators in Qatar have failed to make substantive progress, though the warring sides have been holding meetings in recent days.
Iran on Wednesday told Taliban and Afghan government representatives it stood ready to help end the crisis in Afghanistan, urging the country's people and politicians to make "difficult decisions" about its future.
Hosting a meeting of Afghan government representatives and a high-level Taliban political committee, Mr Zarif said "committing to political solutions is the best choice".