Pakistan authorities have given 1.7 million Afghans they say are living in the country illegally until November 1 to leave voluntarily, or else face arrest and deportation.
Analysts say rising militancy, an economic crisis and souring relations between the Taliban government in Afghanistan and Pakistan are behind the mass eviction.
- Why is Pakistan deporting Afghans? -
Pakistan's government said the deportation of Afghans they say are living illegally in Pakistan is driven by a security crisis, after a spike in the number of attacks in Pakistan's border regions over recent months.
"There have been 24 suicide attacks since January, 14 of these 24 were carried by Afghan nationals," caretaker Interior Minister Sarfraz Bugti told reporters when he announced the order at the start of October.
They accuse the Taliban government of giving safe haven to militant groups they say are behind the attacks, such as the Pakistani Taliban (TTP) -- a separate group from the Afghan Taliban but with a shared ideology.
"The Taliban government is not really listening to Pakistan about the TTP's presence on its soil. Pakistan wants them to be contained and the Taliban are unable and unwilling to do so," political analyst Hasan Askari based in Islamabad told AFP.
Pakistan is also trying to crack down on cross-border smuggling, which it says is deepening the country's economic crisis, by tightening controls at legal crossings.
- How has the Taliban reacted? -
The Kabul authorities have condemned the deportation order as "cruel and barbaric", and warned it will further dent relations with Islamabad.
"Pakistan's expectations of the Taliban regime (about security) have not been fulfilled and (Pakistani authorities) have decided to use this as one instrument to pressurise them," Muhammad Amir Rana, a security and political analyst and director of Pak Institute for Peace Studies (PIPS).
The mass return of Afghan refugees and a tightening of legal crossings for trade will also put pressure on Afghanistan's fragile economy, which is heavily reliant on international aid.
Critics say Afghan refugees are paying the price for a falling out between the two governments.
- How will the deportations happen? -
At the start of October, the government gave Afghans until the end of the month to leave voluntarily or start facing arrest and deportation from November 1.
In the Pakistani city of Karachi, many Afghans living in refugee camps say arrests and raids on homes and businesses have already begun.
From Wednesday this week, the interior minister said he would "not compromise", and that undocumented Afghans would be arrested and taken to holding centres for processing to be deported.
However, with thousands of families rushing to the border to avoid arrest, the crossings are already under huge pressure.
- What is the response to the deportation deadline? -
Observers say Pakistanis have been generally supportive of sending back undocumented Afghans, with a protracted refugee presence putting a heavy burden on the country's infrastructure.
An editorial in the English language newspaper The Express Tribune said the decision was a "well-considered move".
"It's late but never too late. The government's deadline... comes as a challenge, and the onus is on Pakistani authorities to see to it that it is implemented in letter and spirit, and does not pass away as another unkept promise," it said.
However, there have been calls for a more compassionate approach and a longer timeframe, especially after reports of police harassment, extortion, arrests of children and demolishing of homes.
The UNHCR refugee agency has warned many of those who are facing deportation "will be at grave risk of human rights violations if returned to Afghanistan, including arbitrary arrest and detention, torture, cruel and other inhuman treatment".
- Why are there so many Afghans in Pakistan? -
Pakistan is one of the world's largest refugee-hosting countries, with millions of Afghans pouring into Pakistan over decades of successive wars to seek refuge.
The majority live in Khyber Pakhtunkhwa province which neighbours Afghanistan, and which has a shared Pashtun ethnicity.
According to the UN's refugee agency, at least 600,000 Afghans fled for Pakistan after the Taliban returned to power in August 2021.
Pakistan has no domestic legal framework for refugees and is not a signatory to the UN Refugee Convention, leaving migrant and refugee Afghans vulnerable to changing policies.