Afghan refugees born in Pakistan will be offered citizenship, Prime Minister Imran Khan said on Monday in a dramatic change of policy that could benefit of hundreds of thousands of marginalised people.
The move would also extend to Bangladeshi refugees, Mr Khan said.
Pakistani law already offers citizenship to anyone born in the country but this has not been applied either group, leaving them without identification documents needed for essential services and vulnerable to harassment.
The United Nations says there are about 1.4 million registered Afghan refugees in Pakistan who have fled war and persecution over four decades, making it the largest refugee population in the world. A large proportion were born there.
Pakistan also holds an estimated 200,000 ethnic Bangladeshis, many of them stranded since Bangladesh gained independence from Pakistan in 1971.
Analysts expressed surprise at Mr Khan's proposal, questioning whether it was a ploy to appeal to voters from the cross-border Pashtun ethnic group, and whether it was politically possible for him to implement. There was no immediate response from the Afghan government, which has in the past called on its refugees to return and rebuild their country.
Mr Khan made the announcement during a visit to the port city of Karachi, which has a large Afghan population and has also been plagued by gang violence.
He said failing to give refugees citizenship or documents deprived them of work and was forcing them into crime and the black market.
“Afghans whose children have been raised and born in Pakistan will be granted citizenship, God willing, because this is the established practice in countries around the world," Mr Khan said.
"You get an American passport if you are born in America. Then why can't we do it here. We continue to subject these people to unfair treatment.”
He went on: “They are humans. How come we have deprived them and have not arranged for offering them national identification card and passport for 30 years, 40 years."
Millions of Afghans fled to Pakistan after the 1979 Soviet invasion and the years of civil war and Taliban rule that followed. While many returned after the fall of the Taliban government in 2001, the resurgence of the militant insurgency has generated a new wave of Afghans fleeing violence.
The fate of the refugees is a long-running source of tension between Pakistan and Afghanistan. Islamabad believes it has borne the burden of millions of its neighbours for long enough and has repeatedly threatened mass repatriations.
During a visit to Kabul at the weekend, Pakistan's Foreign Minister Shah Mehmood Qureshi said his country had shown “unmatched hospitality” and called for “dignified and sustainable repatriation”.
Giving the refugees citizenship would entitle them to Pakistan's computerised national identification card (CNIC), without which they have been cut off from basic services, including enrolment at state schools, banking and renting or buying property. They have also faced police and bureaucratic harassment, and are often accused of harbouring or encouraging militants and posing a security risk.
“It's quite a change on the face of it, it's remarkable. Without a CNIC they are deprived of a great many benefits,” said Saroop Ijaz of Human Rights Watch.
Although Pakistani law already allows anyone born in the country to gain citizenship, unless they are the child of a foreign diplomat or an "enemy alien", this "certainly hasn't been applied to Afghan refugees or Afghan nationals as far as I'm aware", an international official working with refugees told The National.
“This is potentially a game changer for a huge number of people, but we have to see what happens now."
The UN's refugee agency welcomed Mr Khan's announcement. "We look forward to working closely with the government of Pakistan on this issue in the coming weeks,” said Dan McNorton, spokesman for the agency in Islamabad.
Mr Khan used his first speech after his election in July to say he wanted an EU-style open border between Pakistan and Afghanistan.