Pakistani authorities on Wednesday were set to open a series of centres across the country to begin processing hundreds of thousands of undocumented Afghans ahead of mass deportations.

The government has given 1.7 million Afghans it says are living illegally in the country until November 1 to leave voluntarily or be forcibly removed.

More than 100,000 have already left in the past month, with more than 20,000 gathered at the border on Tuesday as the deadline loomed.

"Only those people who are completely illegal will leave Pakistan," Interior Minister Sarfraz Bugti said in a video statement

The Taliban government's defence minister Mullah Yaqoob said Pakistan's policy was "cruel and barbaric".

A spokesman for the Khyber Pakhtunkhwa provincial government said holding centres where Afghans would be held for one or two days for processing, would open from November 1.

"If someone refuses (to leave) they will be detained and deported. The combing operation against illegal Afghans will start from tomorrow," Feroz Jamal told AFP on Tuesday.

More than 80 percent of those already gone have left via the northern Torkham border in Khyber Pakhtunkhwa province, where the majority of Afghan migrants live.

Pakistan has said the deportations are to protect the country's "welfare and security" after a sharp rise in attacks, which the government blames on militants operating from Afghanistan.

The policy has widespread support from Pakistanis, observers say, with a protracted refugee presence putting a heavy burden on the country's infrastructure.

Police in the province said they have not yet begun arrests as families leave voluntarily, but Afghan refugees in Karachi and Islamabad have reported arrests, harassment and extortion.

Lawyers and activists have said the scale of the crackdown is unprecedented, appealing for Afghans -- some of whom have lived for decades in the country -- to be given more time to pack up with dignity.

"The Pakistani government is using threats, abuse, and detention to coerce Afghan asylum seekers without legal status to return to Afghanistan or face deportation," Human Rights Watch said on Tuesday.

"The situation in Afghanistan remains dangerous for many who fled, and deportation will expose them to significant security risks, including threats to their lives and well-being."