The resurgent Taliban have taken more territory in Afghanistan in the last two months than at any time since they were ousted from power in 2001.
Over the last 20 years, the control map of Afghanistan has been an ever-changing canvas. Here, we look at the fluctuating picture of who controls which areas.
It appears the Taliban have been emboldened in recent weeks by the withdrawal of US troops - retaking many districts from government forces.
Research from the BBC Afghan service shows the militants now have a strong presence across the country, including in the north and north-east and central provinces like Ghazni and Maidan Wardak. They are also closing in on major cities such as Kunduz, Herat, Kandahar and Lashkar Gah.
By control, we mean districts where the administrative centre, police headquarters and all other government institutions are controlled by the Taliban.
US troops and their Nato and regional allies forced the Taliban from power in November 2001. The group had been harbouring Osama Bin Laden and other al-Qaeda figures linked to the 11 September 2001 attacks in the US.
But despite a continued international presence in the region, billions of dollars of support and training for the Afghan government forces, the Taliban regrouped and gradually regained strength in more remote areas.
Their main areas of influence were around their traditional strongholds in the south and south-west - northern Helmand, Kandahar, Uruzgan, and Zabul provinces. But also, in the hills of southern Faryab in the north-west and the mountains of Badakhshan in the north east.
A BBC study in 2017 showed the Taliban were in full control of a number of districts. But the research also showed they were active in many other parts of the country, mounting weekly or monthly attacks in some areas, suggesting significantly higher strength than previous estimates.
About 15 million people - half the population - were reported to be living in areas either controlled by the Taliban or where the Taliban were openly present and regularly mounted attacks against government forces.
Are the Taliban holding ground?
Although they now control more territory than they have since 2001, the situation on the ground is fluid.
The government has been forced to abandon some district administrative centres, where it could not withstand pressure from the Taliban. Others have been taken by force.
Where the government has been able to reorganise its forces or gather local militias, it has recaptured some areas that were lost - or fighting in those areas continues. Although most US troops left in June, a handful remain in Kabul and the US Air Force has carried out airstrikes against Taliban positions over the past few days.
Maps showing changing control of districts
Afghan government forces mainly hold the cities and districts which are on the plains or in river valleys - which is also where most of the population live.
Areas where the Taliban are strongest are sparsely populated, with fewer than 50 people per square kilometre in many areas.
Population by province
The government says it has sent reinforcements to all major cities that are threatened by the Taliban and has imposed a month-long night curfew across almost all of the country in a bid to stop the Taliban from invading cities.
Although they appear to be closing in on centres such as Herat and Kandahar, the Taliban have not yet been able to capture one. The territorial gains they do make, however, strengthen their position in negotiations, and also generate revenue in the form of taxes and war booty.
A record number of civilians have been killed as a result of the conflict in the first half of this year. The UN blames most of the 1,600 civilian deaths on the Taliban and other anti-government elements. The fighting has also forced many people to flee their homes - around 300,000 have been displaced since the start of the year. The UNHCR says a new wave of internal displacement across the provinces of Badakhshan, Kunduz, Balkh, Baghlan and Takhar comes as the Taliban has captured large swathes of rural territory.
Some people flee to villages or neighbouring districts and return home days later, others remain displaced for some time. The AFP news agency reports that the Taliban's offensives have also forced Afghan refugees and government troops to cross the border into Tajikistan.
People forced to leave their homes wait for a border crossing to openimage copyrightGetty Images
The Taliban are also reported to control a number of major border crossings, including Spin Boldak, a major gateway to Pakistan.
Map showing border crossings and checkpoints taken by Taliban
Customs duty on goods entering the country via crossings they control is now collected by the Taliban - although exact amounts are unclear as the volume of trade has fallen as a result of the fighting.
But, Islam Qala on the border with Iran was, for example, capable of generating more than $20m per month.
Disruption to the flow of imports and exports has affected prices of essential goods in the markets - fuel and foodstuffs in particular.