For 31 years, Sabruddin enjoyed his life in Pakistan. Though he spent much of his childhood in a refugee camp after escaping war in Afghanistan, his home country, and despite being born with a damaged left hand, Sabruddin managed to carve out a good adult life for himself as a labourer. At 40, he supported a family of eight and had a neat house in the Peshawar valley. His Pakistani neighbours treated him with friendship and respect.

But recently, that changed. In December, nine gunmen killed 148 people, most of them children, at a military school in Peshawar. After the massacre, Pakistanis in the country’s north-west province of Khyber Pakhtunkhwa turned their anger against Afghans with whom they have lived, side by side, for decades. The school attackers were from the Pakistani Taliban, but all were foreigners and two of them Afghan.

This week, police officers came to Sabruddin’s door and threatened him with prison if he did not leave Pakistan immediately. Several people in his village had already been detained. Sabruddin, being his household’s sole provider, could not afford detention. So he bundled his family and a few belongings together and set off in a rented truck.

“I could see the situation heating up so I left of my own free will,” Sabruddin said.

That kind of “free will” has prompted a veritable exodus. In the past month, droves of Afghans have left Pakistan to avoid harassment and imprisonment by the country’s authorities, leaving decades of life behind.

Since the beginning of January, more than 22,560 Afghans have returned “spontaneously”, as it is termed by the International Organisation of Migration (IOM), which registers returning Afghans at the border and assists the most vulnerable.

At the moment, more than 100 Afghan families – roughly 650 people – leave Pakistan every day as a result of harassment and threats from authorities and their communities. That is 23 times as many as in December. As of 27 January, approximately 1,500 Afghans have also been forcibly deported, more than one-third of the total number of deportees in 2014.

The returning Afghans travel over the Khyber Pass through Torkham, a bustling border crossing that is one of Afghanistan’s main commercial entry points. Every day, about 500 trucks cross the border, kicking up a beige haze of dust. Men push clattering metal carts carrying burqa-clad wives and daughters through checkpoints, as innumerable families trek across in each direction to visit relatives.

Abdul Qader and his family left Pakistan after harassment from the authorities. Here they are shown crossing the border at Torkham; behind the hilltop fence lies Pakistan

Queues build up at the border bottleneck regularly, forcing returning families to wait in the relentless sun for hours, at the mercy of nature and manmade bureaucracy. While they wait, representatives from the World Health Organisation comb through trucks and vans to vaccinate toddlers against polio, a disease prevalent in Pakistan but almost eradicated in Afghanistan.

Once families are back in Afghanistan, a bleak future awaits. Many have only threads to hang on to: distant relatives or a plot of land that may have been taken over. Richard Danziger, chief of mission for IOM in Afghanistan, says that most Afghans who are returning spontaneously have spent between 15 and 25 years in Pakistan, “so they have very little to come back to”.

When Abdul Qader, 55, left the northern Afghan city of Kunduz, his house was half-built. That was 32 years ago, but now he has nowhere else to go. His only option is to return to a property in unknown condition, and to a plot of land that may have been claimed by somebody else. Earlier this week, he was woken up at midnight when police broke through his front gate in Gujarat, and pushed his entire family into minibuses.

“During my time in Pakistan I have seen a lot of police oppression and harassment of Afghans, but at least they were respectful to the women,” Qader said. “This time, they touched the women and shoved them into vehicles.”

Jawed, an Afghan man with no possessions, receives assistance at the IOM’s Torkham transit centre after returning to Afghanistan from Pakistan

Pakistan is home to at least 1 million Afghans without official documents, who are exposed to the risk of sudden eviction. Another 1.7 million Afghans are registered refugees in Pakistan. The provincial government of Khyber Pakhtunkhwa has announced plans to expel all undocumented Afghans from the province. The authorities did the same in 2012, but backed down after international pressure.

If the current pattern continues, the high volume of returning Afghans could affect cross-border relations in a predominantly Pashtun region. Strong tribal ties have historically eased settlement for Afghans in Pakistan, even if they lacked documents. But some of the returning Afghans said those ties have now become strained.

“The Pakistani people were good to us. Let me give you an example: when my house burned down, Pakistanis gave clothes to my daughter,” says Gul Agha, a labourer who crossed the Torkham border on Thursday. In early January, the police in Peshawar jailed Agha for a month, until he heeded their threats and left the country.

“The army and the police were always bad,” Agha says. It was the way his neighbours started treating him differently that surprised him. “After the attack, they said: ‘How can you be Muslim and kill other Muslims?’”