For Samihullah, a tailor from a family of Afghan refugees in Pakistan, the first indication that it might be time to leave the country was the insults levelled at him in the bazaar.
Born to refugee parents in the northern Pakistani town of Mansehra, he never gained citizenship but was always considered an Afghan, something which began to count against him as local resentment grew over Afghanistan's deepening ties with India.
Many Pakistanis view India as their enemy at the best of times, and that attitude has hardened in recent months as tensions between the nuclear-armed rivals have risen.
"Afghans used to be called 'Kabuli' in Pakistan, but now Pakistanis call them 'Hindus' because we signed economic agreements with India," said Samihullah, who, like many Afghans, goes by one name.
Married with two wives, one Afghan and one Pakistani, the 32-year-old is among thousands of people who have gone to Afghanistan and are housed temporarily in a refugee centre near Kabul.
Even before the latest clashes between Indian and Pakistani soldiers in the disputed Kashmir region, the climate was more hostile.
"They were telling us, we chose India's friendship so we should go to India. We were hiding in our shops and homes to avoid being arrested," Samihullah said.
After almost 40 years of war in Afghanistan, Pakistan has some 1.5 million registered refugees, one of the largest such populations in the world, according to the United Nations refugee agency. More than a million others are estimated to live there unregistered.
Islamabad, which announced new repatriation plans last year, has stepped up pressure to send people back and numbers have risen sharply in recent months as Afghan-Indian relations strengthened and those between India and Pakistan soured.
"These people were our guests, we kept them in our house. Afghanistan should be grateful to us," said a Pakistani army official based in the southern city of Quetta.
"Instead it ... has become buddies with India, it's like stabbing us in the back."
The treatment Samihullah and others at the reception centre complain of reflects how quickly diplomatic tensions can affect refugees, many of whom must start again from scratch.
"These returnees are coming back after more than three decades in exile," said Maya Ameratunga, director of UNHCR's Country office in Kabul. "It will take a big adjustment."
The United Nations provides US$400 a person in emergency help as well as medical and other assistance, but international funds are drying up in the face of a series of global crises.
Longer term reintegration into a country many never knew as home may be difficult.
"Some people are able to go to live with relatives, but others may not have that possibility. So unfortunately what we are seeing is people becoming displaced," Ameratunga said.
"HONOUR AND DIGNITY"
Ties between Afghanistan and Pakistan have long been clouded by mutual accusations that militant extremists find shelter on the other side of the border.
But Pakistani officials deny there has been systematic harassment of Afghans living in Pakistan and say their country has demonstrated great generosity to the refugee population, despite severe economic problems of its own.
"We want them to return home in peace with honour and dignity," said Akhtar Munir, spokesman at the Pakistani embassy in Kabul, adding that there was no connection between the repatriation of Afghan refugees and India.
He said Pakistani police had clear instructions not to harass registered refugees, but added that some Afghans living illegally in Pakistan were involved in crime, and action against criminals should not be seen as mistreatment of refugees.
The spike in the number of returnees has, however, moved in step with escalating friction between Afghanistan and Pakistan, which flared into brief clashes at the Torkham border crossing in June.
A series of economic and political accords with India in recent months and the fanfare around the completion of the Indian-financed Salma dam in western Afghanistan in June has also weighed on relations.
According to UNHCR figures, the number of assisted returns jumped from 1,433 in June to 11,416 in July and 60,743 in August. More than 90,000 have been returned to Afghanistan so far this year, almost all from Pakistan, and the number is expected to pass 220,000 for the year.
Although repatriation is not compulsory, many Afghans say life in Pakistan has become so uncomfortable they feel they have little choice.
Even in areas like Baluchistan in the south, where authorities have long taken a more lenient view of refugees than in the northwest frontier areas, attitudes have changed, particularly in the wake of recent attacks.
"My son was stopped at a checkpoint and an officer tore up his Afghan citizenship card," said Bibi Shireen, who moved to Quetta from the southern Afghan city of Kandahar 30 years ago.
"Now he has no identification and we're scared he could get picked up any day now and sent away because he isn't registered," she said.
Previously, Afghan refugees did not need visas or passports to cross the porous frontier. This has now changed, a step Pakistan says is needed to ensure control of militant extremists on both sides of the border.
Despite the problems, many returnees say they are not unhappy to be back, though they need help with food and shelter as harsh winter months approach.
"We did our best over the past 20 years but could not make a living," said Sheer Banu Ahmadzai, a burqa-veiled mother who left her home in the northern province of Baghlan as a child. "I hope we have the chance to make a living in our own country."