Pakistani and Afghan officials accused each other of killing civilians on Friday after gunfire erupted near a major border crossing where Pakistani census officials were carrying out a count.
Officials said at least one person was killed on each side. But local news outlets on the Pakistani side reported at least nine people, including five women and three children, were killed and 40 others wounded.
Local media also reported the use of artillery shelling during the clashes.
In a statement Prime Minister Nawaz Sharif said it was Afghanistan's responsibility "ensure that such incidents are permanently stopped".
Pakistan's foreign ministry summoned Afghanistan's charge d'affaires in Islamabad to protest, calling the firing "unprovoked" and saying several people died, without specifying numbers.
The gunfight prompted Pakistani authorities to shut the Chaman border crossing, one of only two major crossing points along the disputed frontier, and threatens to exacerbate already tense relations between Islamabad and Kabul.
"Afghan border police opened fire on FC (Frontier Corps) detailed for the security of population census team," the Pakistani military said in a statement, adding that one civilian had been killed and 18 others, including four soldiers, were injured.
The statement accused Afghan officials of "creating hurdles" for census work in the area, and added that, "This was done despite the fact that Afghan authorities had been informed well in advance and coordination was carried out through diplomatic and military channels for conduct of the census."
Afg Bdr Police opens fire on FC tps detailed for security of Census in a village along Chaman Bdr. 1 Civ Shaheed,18 incl 4 FC sldrs injured. pic.twitter.com/ce6hdqQzuu— Maj Gen Asif Ghafoor (@OfficialDGISPR) May 5, 2017
Samim Khpalwak, spokesman for the governor of Afghanistan's Kandahar province, said the Pakistani officials had strayed onto the Afghan side of the border and were attempting to count people living there.
Zia Durani, police spokesman for Afghanistan's Kandahar province, said Pakistani officials were using the census as a cover for "malicious activities and to provoke villagers against the government."
At least four Afghan army personnel were killed and 37, including 23 civilians and 14 military personnel were injured on the Afghan side of the border.
The incident took place on the "Durand Line," a 2,400-kilometre (1,500-mile) frontier drawn by British colonial rulers in 1893 under an agreement with the then-emir of Afghanistan. Kabul disputes the "Durand Line" and does not officially recognise it as an international border.
Border controls had been virtually absent in the area. Traders, travellers, smugglers and militants alike crossed the line with impunity until recent clampdowns by Pakistan.
Recent efforts by Pakistan to build a barrier at the main border crossing in the town of Torkham, near the Khyber Pass, had also angered Afghanistan last year.