Afghan refugee children play outside a mud hut in an encampment outside Islamabad, Pakistan, on Sept. 18. (Pam Constable/The Washington Post)

Saeed Hamid’s restaurant is covered with touristic murals from Afghanistan – blue-tiled shrines and aqua lakes, ancient Buddhas carved into cliffs, and an enormous scene of horses and riders scrimmaging on a muddy field, trying to capture the carcass of a goat.

But Hamid’s nostalgia stops right there. His parents fled their conflicted homeland before he was born, and he grew up in Pakistan’s capital. He learned English, married and raised his own children here, and built a flourishing bakery and kebab house that employs 20 people and is packed every evening.

So it is easy to understand his anxiety about the future. In the past year, more than 250,000 undocumented Afghan refugees have returned to their impoverished, insurgent-plagued country under pressure from Pakistani authorities. Now, the population of 1.5 million long-settled, registered refugees has been given six months to leave as well.

“No one has bothered us yet, but everyone is worried,” Hamid said one recent afternoon, as the smell of newly baked bread filled his eatery. “We are happy and busy here. If we had to go back, there would be nothing to do and no one to welcome us, only the Taliban and Daesh,” he said, using the Afghan term for the Islamic State militants.  

For decades, next-door Pakistan has provided a safety valve for Afghans who fled successive periods of conflict and repression, hosting up to 5 million at a time. The reception has not always been enthusiastic, but it has been heavily subsidized by the United Nations, and most refugees have easily blended into the large population of ethnic Pashtuns that historically straddled the border. 

Mohammed Zikria, 19, an Afghan refugee, works in a bakery in Islamabad. (Pam Constable/The Washington Post)

They have also been a headache for security agencies, who often complained that some refugee camps and communities harbored thieves, drugs and armed militants, and that it was impossible to police a population that flowed loosely across the border and in many cases held no official IDs. 

The refugee population has also become hostage to tensions between Pakistan and Afghanistan, with both countries accusing each other of harboring militants in the porous border regions. In late 2014, when terrorists invaded a Pakistani military school, killing 141 students and teachers and enraging public opinion, authorities vowed to start sending the refugees back.

The push took many forms, from police harassment to a government publicity campaign, endorsed by officials in Kabul, that urged Afghans to return with the slogan, “My home is my flower.” After refugee leaders protested, departure deadlines were postponed several times, but the trickle of returnees swelled to tens of thousands early this year, especially after the United Nations added an extra cash bonus for each family once they resettled in Afghanistan.

The surge intensified in June, when Pakistan erected a large gate at Torkham, the major border crossing near Peshawar, and announced that no Afghans could re-enter without a passport and visa. That was tantamount to social death for refugees used to visiting relatives back home, then returning to the safety and prosperity of Pakistan. Riots and shootings broke out at the border gate, but the passport policy stood.

“Torkham gate was the biggest factor. It sent out a very clear message that this was not going to be business as usual,” said Imran Zeb Khan, Pakistan’s chief commissioner for Afghan refugees. He said the cash incentives, as well as public encouragement from Afghan diplomats here, added to the push. By early September, more than 260,000 Afghans had been formally repatriated.

So far, most of the returnees have been undocumented refugees, those who had never registered with U.N. officials and lived in Pakistan illegally for years. Many were poor families without job skills and little to show for their years abroad; 70 percent were younger than 24, and 75 percent had been born in Pakistan. Of an estimated 1 million unregistered refugees, officials said ­700,000 still remain here.

One day last week, hundreds of Afghan men, women and children waited outside a government center near Peshawar, where officials registered them as refugees for the first time and approved them for repatriation subsidies. Some said they were reluctant to leave and fearful of what awaited them. Others said they had been harassed by police and pressured for bribes to cut their waiting time.

“Last month some of my relatives went back, and the Afghan government claimed it would provide them with rations and housing, but they are living in a tent,” said Meera Jan, 89, who had waited in line for hours. “They have urged me not to leave, but the police and other officials won’t let us live here anymore. I am an old man and I can die in either country. What can I do?”

Officials at the center seemed overwhelmed, saying that the number of applicants was far higher than expected and that many were confused or had problems proving their identity. Even so, Shabbir Nawaz, a supervisor, said the center is handling about 700 people per day. “We are trying our best, but most of them are uneducated and have no understanding of the process,” he said.

Faced with a raft of complaints and a crush of applicants, the government of Prime Minister Nawaz Sharif has already repeatedly extended the deadline for “voluntary repatriation.” Earlier this month, he ordered the latest departure date postponed from the end of November to next March. 

“Afghans are our brothers and very dear to us,” Sharif said in a statement announcing the reprieve. “We will not allow Afghan refugees living in Pakistan to be terrified in any way. They are our guests.”

Sharif’s gesture was small consolation, however, for hundreds of thousands of registered refugees, especially those who own property or businesses and believed their official status was a guarantee of permanence. Instead, they are suddenly vulnerable to financial cheating and pressure — unable to get a fair price for a car, legally barred from selling a house and worried that they will be unable to collect on debts or investments.

Khan, the commissioner for refugees, said the government is aware of such problems, as well as other family issues such as unfinished school semesters and college degrees. He said a meeting has been called with leaders of all Pakistani political parties to work out practical solutions. Individuals with special hardships, he said, are being allowed to apply for Pakistani identity documents. 

Meanwhile, though, longtime refugees such as Mohammed Rauf Derrighel, 63, are fuming. “I was a child when I came here. Now I am an old man, and suddenly I am being told to go. I feel helpless,” complained the burly, gray-bearded businessman, who was commiserating with a friend at his tailor shop in Islamabad.

On the outskirts of the capital, hundreds of Afghans live in clusters of flimsy mud and straw-roofed huts, using car batteries to turn on light bulbs and tending goats among campfires. But despite such precarious circumstances, some are registered refugees with long-standing jobs or investments in industries such as scrap metal that they now fear could be lost. 

Babur Khan, who has lived in Pakistan since he was 2, squatted outside a hut one recent afternoon, listening as his brothers and cousins talked about their concerns. Suddenly he went inside and came back out with a folder of legal documents, signed and notarized several months before. They certified that he had invested $2,000 in a scrap-metal business and that the Pakistani owner would pay him a few pennies’ profit for each kilo. It was his entire savings, and he now wondered if he had made a mistake.

“Our dealings have always been smooth, but since the Torkham gate fight, everything has been disturbed,” said Khan’s older brother Hassan. “People were fair with us in the past, but now they know we have to leave, and they want to cheat us. We are like a flock of sheep. The owner kept us for 35 years, and then suddenly he went mad and threw all the sheep in a river.”

Aamir Iqbal contributed to this report from Peshawar, Pakistan.