Thousands of people are scrambling to flee Afghanistan after the Taliban seized back control of the country, almost two decades after they were ousted by a US-led coalition.
The United Nations has warned that up to half a million Afghans could flee the country by the end of the year and has called on neighbouring countries to keep their borders open.
The current crisis comes on top of the 2.2 million Afghan refugees already in neighbouring countries and 3.5 million people forced to flee their homes within Afghanistan's borders.
How many Afghans were evacuated?
The US-led operation to evacuate people by air has now ended, with the last flight taking off from Kabul airport just after midnight on Tuesday - a deadline agreed with the Taliban for foreign forces to withdraw.
More than 123,000 civilians were evacuated by US forces and its coalition partners after the Taliban took control of the capital on 14 August - but it's unclear exactly how many of those were Afghan nationals.
The US has said that it flew nearly 80,000 civilians out of Kabul and of those, about 5,500 were Americans and more than 73,500 were either Afghans or other foreign nationals.
While the UK Ministry of Defence, which ended its evacuations on Saturday, said it had flown out more than 15,000 people and some 8,000 of them were Afghans.
At the height of the operation, the US said its military planes were departing the airport every 39 minutes - although the evacuations did slow down after the suicide bomb attack on the 26 August outside the airport, which killed about 170 people, including 13 American troops.
Many of those flown out of the country were taken to emergency processing centres set up in several countries, including Spain, Germany, Qatar and Uzbekistan.
As many as 300,000 Afghans have been affiliated with US operations in the country since 2001, according to the International Rescue Committee, and tens of thousands of them are eligible to obtain a US visa - but many will now have to find a different way out of the country.
At the weekend, the US said it had received assurances from the Taliban that Afghan nationals who are issued with valid travel documents by another country will be allowed to leave Afghanistan.
What's happening on the border?
The Taliban control all the main land crossing points with Afghanistan's neighbours (shown on the map below) and reports suggest they are only allowing traders or those with valid travel documents to leave the country.
However, many of those trying to flee because they fear for their safety under Taliban rule will not have any paperwork.
The UN has urged Afghanistan's neighbours to keep their borders open to refugees and called on the international community to support those countries.
But Uzbekistan, which borders the north of Afghanistan, has said its main crossing point is closed to "ensure security" and there are no plans to open it.
Pakistan, which has the longest border with Afghanistan, has also said it will not accept refugees - with its US ambassador telling the BBC: "We are already overburdened by the refugees, and it is beyond our capacity to host any more refugees."
Last week, satellite imagery of the Spin Boldak crossing point between Afghanistan and Pakistan showed a large crowd of people gathered on the Afghan side.
The BBC's Shumaila Jaffery, who was at the crossing point, said it was a chaotic scene with many Afghans not being allowed to enter Pakistan.
Last Friday, two Afghans were reportedly killed by Pakistani security forces at the Torkham border crossing after trying to enter Pakistan illegally.
There have also been reports of thousands of Afghans trying to cross the western border with Iran, but it's unclear how many have been successful.
How many have fled their homes?
The latest movement of Afghans is part of a historical exodus from a country that has suffered instability and conflict over many years.
Even before the Taliban retook control, more than 550,000 people had been forced to flee their homes this year due to fighting, according to the UNHCR.
That means an estimated 3.5 million Afghans are currently internally displaced within the country.
In addition to those within Afghanistan's borders, about 2.2 million refugees and asylum seekers were also seeking sanctuary in neighbouring nations as of the end of last year.
This year, Afghans have also had to deal with a severe drought and food shortages across most of the country. A report by the UN World Food Programme (WFP) in June said that 14 million people - more than a third of the population - were suffering from hunger.
Mary-Ellen McGroarty, WFP country director for Afghanistan, said last week that unless emergency food and medical supplies arrived soon, the "already horrendous situation" would become "an absolute catastrophe, a complete humanitarian disaster".
Where do Afghan refugees go?
Neighbouring countries Pakistan and Iran saw the highest numbers of Afghanistan's refugees and asylum seekers last year.
Almost 1.5 million fled to Pakistan in 2020, while Iran hosted 780,000, according to UNHCR figures.
Germany was third, with more than 180,000, while Turkey took nearly 130,000.
When looking at asylum seeker numbers only - those who have applied for sanctuary in another country but whose claims have not yet been granted - Turkey, Germany and Greece top the list, with about 125,000, 33,000 and 20,000 respectively.
Although there are no Afghan asylum seekers in Iran, those with refugee cards - an official document recognising their status - are able to access the country's health and education systems.
What are countries doing to help?
While some countries have offered Afghans safe haven, others have indicated they will not be giving sanctuary to those fleeing.
Iran has set up emergency tents for refugees in three of its provinces which border Afghanistan. But senior officials from the Iranian interior ministry have said that any Afghans who crossed into Iran would "once conditions improve, be repatriated". Iran already hosts nearly 3.5 million Afghans, according to the UN.
Prime Minister Imran Khan said in June that his country would seal its border with Afghanistan if the Taliban took control. However, reports say several thousand Afghans have crossed into Pakistan and that at least one border crossing is open. The Taliban are said to be restricting access to traders and those with valid travel documents.
Exact numbers are unclear but reports suggest at least several hundred Afghans, including soldiers from the Afghan National Army, crossed into Tajikistan as the Taliban advanced on Kabul. In July, Tajikistan said it was preparing to take in up to 100,000 refugees from Afghanistan.
About 1,500 Afghans are said to have crossed the Afghanistan-Uzbekistan border and set up camp. Reports suggest the Taliban are only allowing people with valid visas to use official border crossings.
The UK has announced plans to accept 20,000 Afghan refugees over the long term. The British government's Afghan Citizens' Resettlement Scheme will aim to allow 5,000 Afghans to settle in the UK in the first year and will focus on women and children as well as religious and other minorities in greatest danger from the Taliban.
President Joe Biden has authorised $500m (£367m) for "unexpected urgent refugee and migration needs of refugees, victims of conflict, and other persons at risk as a result of the situation in Afghanistan, including applicants for special immigrant visas". The US has not announced an exact number of refugees it will allow in.
Canada has said that it will resettle 20,000 Afghans, focusing on those in danger from the Taliban, including government workers and women leaders.
Australia says it will offer 3,000 places in its humanitarian visa programme to Afghans fleeing their country. But the places will come from the existing programme of available humanitarian visas, and there will be no increase in overall numbers.
Officials in several European Union countries say they are keen to avoid a repeat of the 2015 migrant crisis, when there was a populist backlash to large numbers of refugees being allowed to enter EU territory.
Germany has indicated that it will accept some Afghans, but has not specified numbers. Chancellor Angela Merkel, who faced sharp criticism for her open-door policy towards migrants in 2015, has said that her government was focused on making sure that refugees "have a secure stay in countries neighbouring Afghanistan".
President Emmanuel Macron has said that Europe must "protect itself from significant waves of illegal migrants" from Afghanistan. He said France would "protect those who are in the most danger", but added: "Europe cannot take on the consequences from the current situation alone."
Austria has ruled out taking any Afghan refugees. The country's interior minister has argued in favour of continuing to deport failed Afghan asylum-seekers and has lobbied for the establishment of "deportation centres" in countries neighbouring Afghanistan, where direct deportation to Afghanistan is not possible.
Switzerland has said it will not accept large groups of refugees arriving directly from Afghanistan.
President Recep Tayyip Erdogan has said his government will work to help stabilise Afghanistan but he has urged European countries to take responsibility for any new migrant crisis, saying Turkey would not be "Europe's migrant storage unit". Turkey has stepped up construction of a border wall with Iran to keep migrants out.
North Macedonia, Albania and Kosovo
North Macedonia and Albania have said that they will temporarily host 450 and 300 refugees respectively at the request of the US. The refugees are expected to stay until documentation for US immigration visas can be arranged. Kosovo is also planning to provide temporary shelter for refugees heading to the US but has not specified numbers.
Uganda has agreed to take in 2,000 Afghan refugees. The East African nation has the largest number of refugees in any country in Africa - and the third largest in the world.