Pakistan has ordered all illegal immigrants, including 1.73 million Afghan nationals, to leave the country by November 1 or face expulsion.
The country's interior minister revealed that 14 of 24 suicide bombings in the country this year were carried out by Afghan nationals.
It was not immediately clear how Pakistani authorities could ensure the illegal immigrants leave, or how they could find them to expel them.
Islamabad's announcement marks a new low in its relations with Kabul that deteriorated after border clashes between the South Asian neighbours last month.
"We have given them a November 1 deadline," said Interior Minister Sarfraz Bugti, adding that all illegal immigrants should leave voluntarily or face forcible expulsion after that date.
Bugti said some 1.73 million Afghan nationals in Pakistan had no legal documents to stay, adding a total of 4.4 million Afghan refugees lived in Pakistan.
"There are no two opinions that we are attacked from within Afghanistan and Afghan nationals are involved in attacks on us," he said. "We have evidence."
Islamabad has received the largest influx of Afghan refugees since the Soviet invasion of Kabul in 1979.
Bugti was speaking in Islamabad after civil and military leaders met the prime minister and army chief to discuss law and order after a recent spate of militant attacks.
The violence has seen an unusual uptick since local Taliban militants known as Tehreek-e-Taliban Pakistan (TTP), an umbrella group of hardline militants, revoked a ceasefire with the government late last year.
Two suicide bombings targeted religious gatherings in Pakistan last week, killing at least 57 people. The TTP denied involvement. Bugti said that one of the suicide bombers had been identified as an Afghan national.
The IS also operates in the Afghan border regions and has been involved in attacks in Pakistan.
The Pakistani military has conducted several offensives against militants, mainly in the rugged mountainous region along the Afghan border, which it says forced them to flee to Afghanistan.
Islamabad alleges that the militants use Afghan soil to train fighters and plan attacks inside Pakistan, a charge Kabul denies, saying Pakistani security is a domestic issue.