Pakistan and Iran absorbed more than 7 million Afghan refugees after the Soviet invasion of Afghanistan in 1979 touched off years of fighting.
Many of the refugees went home after U.S.-backed Afghan forces dislodged the Taliban in 2001.
Now officials here worry that the rapid U.S. drawdown and a decline in Western aid could lead to growing violence and desperation in Afghanistan, prompting residents to flee to Pakistan again.
“I believe this influx is already here,” said Mohammed Abbas Khan, a commissioner at Pakistan’s Office of Chief Commissioner for Afghan Refugees. “We are in a very tight situation ourselves, so having this influx is not desirable to anyone in the world.”
There are no firm figures on the number of new arrivals. But in recent weeks, Pakistani officials say, they have been fielding calls from frantic local authorities about new illegal settlements.
To discourage the immigrants, local officials in northwestern Pakistan are implementing policies that could make it harder for Afghans to rent apartments or erect new squatter camps. In the southern city of Karachi, new police squads are tasked with hunting down illegal Afghan immigrants. And along Pakistan’s 1,500-mile border with Afghanistan, federal officials are preparing to implement new screening procedures.
The crackdown is occurring as Iran is increasingly pressuring the 800,000 Afghan refugees there to leave, according to human rights groups.
In Pakistan, the tightening of controls reflects concerns about the fragile situation in Afghanistan and about this country’s own stability. There are about 1.6 million legally registered Afghan refugees in Pakistan, but officials think that 1 to 3 million more are in the country illegally.
“We want them to go back to their own country,” said Sartaj Aziz, the national security and foreign affairs adviser to Prime Minister Nawaz Sharif. Aziz said that the refugees are a burden on the weak economy and that their presence makes it easier for Islamist militants with ties to Afghanistan to operate undetected in this nation.
When Afghans started flooding into Pakistan after 1979, they were greeted as Muslim brothers who shared the goal of driving the Soviets from Afghanistan.
They were housed in sprawling camps near the border. Pakistan worked with countries such as the United States to line up food and other support for the refugees, some of whom would cross back into Afghanistan as mujahideen fighters to battle the Soviets.
But over time, most of the remaining Afghan refugees moved to Pakistani cities in search of jobs. With most new arrivals also flocking to urban areas, friction between Afghans and Pakistanis has intensified.
Many Afghan refugees are Pashtun, an ethnic group whose rapid growth is altering the demographic makeup of a country that had been dominated by ethnic Punjabis. Pashtuns are now Pakistan’s second-largest ethnic group, eclipsing the Sindhis, who primarily reside in southern Pakistan.
The backlash against the Afghan settlers appears to be driven in part by suspicion that they are more tolerant of Pashtun-dominated militant groups, such as the Pakistani Taliban, which have carried out a campaign of terror in recent years.
In a sign of that concern, in early March authorities sent bulldozers to destroy a settlement on the outskirts of Islamabad, the capital, that housed more than 100 Afghan families. Many residents said they had lived there for nearly three decades.
Two days after the operation, several families said they had not found shelter. Children were using cardboard boxes as blankets as men dug through the rubble, hoping to salvage bricks.
“They didn’t give us any warning,” said Parvez, 20, who has only one name and lives with 12 brothers and sisters. “We still have not eaten breakfast because the kitchen was demolished.”
Like all Afghan settlers, Parvez is not eligible for citizenship or public benefits in Pakistan, even though he has lived there his entire life.
Islamabad officials said they were under pressure from the property owner to clear the settlement, which they noted included some non-Afghan families. But officials also said such Afghan-dominated camps are unsightly and pose a growing security risk, so they might dismantle similar ones in coming months.
Nasreen Ghufran, an international relations professor at the University of Peshawar, said that Pakistanis blame Afghan immigrants for “a lack of social order” — in particular, crime and unsanitary conditions.
“Even the common villagers are using abusive language for them,” said Ghufran, who has extensively studied Afghans who have moved to Pakistan. “Previously, they were considered Afghan brothers, Afghan Muslim brothers who we should be ready to give space and give jobs. Now, they want them to leave.”
After an intense national debate last year, Pakistan’s national assembly decided to allow the 1.6 million legally registered Afghans to stay at least until the end of 2015. But Pakistani authorities are afraid that the number of illegal immigrants could jump if violence surges in Afghanistan after most NATO troops leave this year.
An even bigger concern, Pakistani leaders say, is that Afghanistan’s economy could weaken considerably as Western troops and contractors return home, prompting a flood of job-seekers to cross the border.
Already, Afghan refugees seem increasingly wary of going back to their native land.
While 83,000 Afghan residents returned home from Pakistan in 2012, less than half that number made the trip last year, and so far this year fewer than 2,000 have repatriated, said Abbas Khan, the refugee official.
He said that Pakistan will voluntarily accept large numbers of new refugees only in the event of a “humanitarian catastrophe.” Otherwise, Afghans who travel to Pakistan should expect to be subjected to new biometric border-control technologies such as iris and fingerprint scanners, he said.
Aid workers and analysts are divided over whether a large number of Afghans might try to move to Pakistan. Some say that if security greatly deteriorates in Pashtun-dominated areas of eastern Afghanistan, some people could seek to join family members already in Pakistan.
But the International Organization for Migration concluded in a January report that most Afghans forced to flee their homes would simply go to other parts of Afghanistan. Among the reasons: The land routes to Pakistan are far more dangerous than they were in the 1980s and 1990s.
Still, local officials in Pakistan are nervous.
Qaim Ali Shah, the chief minister of Sindh province in southern Pakistan, said at a news conference in February that there were already more than 1 million illegal Afghan immigrants living in Karachi, a rapidly growing city of 22 million people.
In response, he formed a special police unit to monitor Afghan residents. He also directed police to erect checkpoints to keep illegal immigrants from settling in neighborhoods.
Even in northwestern Pakistan, an area dominated by native-born Pashtuns, there are signs that residents have become less tolerant. In March, the Khyber Pakhtunkhwa provincial assembly passed a law requiring that people renting apartments have recommendations from two Pakistanis.
Ijah Khan, the police chief in Peshawar, said the law is needed because of the growing threat of terrorism and crime. He said 70 percent of major crimes such as extortion and kidnapping are committed by people of Afghan origin.
“Afghans are very nomadic people,” he said. “They change their houses, residences, very frequently, so if they commit a crime, they just move. People are saying we must do something about this.”
But Afghans say few Pakistanis are willing to vouch for them.
“I am not even thinking of food; I am thinking of seeking and getting two guarantors,” said Ali Khan, 47, who fled to Pakistan with his parents when he was 14 and is now looking for a house in Peshawar for his family.
In Islamabad, Afghans also feel they are being pushed out.
Amid the rubble at the recently bulldozed settlement, Mohammed Haleem, who said he is at least 80 years old, recalled how Afghans used to receive free food and support for their battle against the Soviets.
He bent down and pulled up several rain-soaked tarps covering a mound. His parents were underneath the tarps, sleeping on a flimsy cot. A few feet away, the family cow was tied to a pole and defecating.
“Back then, we were taken care of,” Haleem continued, swatting away the flies buzzing around his parents. “Now, we are not welcomed here.”
Washington Post correspondents Haq Nawaz Khan in Peshawar, Pakistan; Shaiq Hussain in Islamabad, Pakistan; and Nisar Mehdi in Karachi, Pakistan, contributed to this report.