Afghans have long complained about constant harassment due to the lack of citizenship rights for those who have spent decades living and working in Pakistan.

Pakistani Prime Minister Imran Khan vowed to grant citizenship to Afghan refugees who have lived in the country for several decades, at a time when relations between Islamabad and Kabul remain tense.

About 2.5 million Afghans, many of whom fled their homeland after it was invaded by the Soviet Union in 1979, live in Pakistan, home to the world's second-largest refugee population.

It was unclear whether Mr. Khan, who was speaking at an event in the southern coastal metropolis of Karachi, intends to grant citizenship to Afghans born in Pakistan or to all those who have made a home there.

“Those Afghans whose children are born here and have grown up in Pakistan we will also, god willing, get [passports] for them,” Mr. Khan said.

“If you are born in America you get an American passport. It happens in all countries around the world so why not here?”

Afghans have long complained about constant harassment due to the lack of citizenship rights for those who have spent decades living and working in Pakistan.

There were concerns earlier this year that Islamabad planned to repatriate refugees back to violence-plagued Afghanistan after Pakistan extended the stay of Afghan refugees living within its borders by only 60 days.

Relations between the neighbours have deteriorated in recent years, with Kabul accusing Islamabad of harbouring Taliban militants who carry out attacks across the border.

Pakistan denies the charge and blames Afghanistan for providing sanctuary to Pakistani Taliban militants responsible for attacks that have taken place on its soil over the past two years.

The move was lauded by human rights activists in Pakistan, who have called for Afghans born in the country to be given nationality in accordance with Pakistani law, which grants citizenship to anyone born in the country.

“Pakistan has been host to one of the largest refugee population in the world and granting citizenship to those eligible seems to be a logical next step both legally and morally,” Saroop Ijaz, a representative for Human Rights Watch told Reuters.

“This move is an important first step in ending the discrimination faced by refugee and migrant communities.”

Mr. Khan also said undocumented Bengali immigrants living in Pakistan would be given passports.

A government anti-trafficking unit placed the number of Bengalis living in Pakistan, many of whom fled Bangladesh for economic reasons following its independence from Pakistan in 1971, at two million in 2012, but it is unknown how many of those are long-term residents.

“Why are they treated without dignity? They are humans, how have we deprived them for 30-40 years?” Mr. Khan said.