At least nine people were killed and dozens injured when Afghan border forces fired at a census team in Pakistan's Balochistan on Friday — a day after the Afghan President turned down invitations to visit Islamabad.

Civil Hospital Medical Superintendent, Akhtar, said in a statement that five children and three women were among those killed in the firing in Chaman area. Police said that four Frontier Corps (FC) personnel were among the injured.

The Afghan forces used heavy artillery to fire at the Pakistani side of the border, the Inter-Services Public Relations said, adding that border forces retaliated to the firing in Kali Luqman and Kali Jahangir areas of Chaman.

"Afghan border police opened fire on FC detailed for security of population census team," the military's media arm said. 

Mortar shells fired from the Afghan side also hit houses in a village of Kali Luqman. At least three children were among the injured, who were shifted to Civil Hospital.

An emergency was imposed in Chaman.

The gunfight prompted authorities to shut the Chaman border crossing, one of the two major crossing points along the disputed frontier.

"Since April 30, Afghan border police has been creating hurdles in conducting census in divided villages of Killi Luqman and Killi Jahangir in Chaman area on Pakistani side of the border," it said.

"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 conducting census."

The country embarked on the enormous task of conducting its first census in almost two decades in March.

Meanwhile, the Foreign Office expressed serious concerns over the unprovoked firing, and summoned the Afghan Charge d' Affairs to lodge protest over the firing.

"The Afghan Charge d' Affairs was conveyed the unprovoked firing from the Afghan side not only led to the loss of precious lives and injured many, but has also disrupted the census in areas," a Foreign Office spokesperson Nafees Zakaria said.

Zakaria said the border between the two countries is clearly demarcated and Pakistani teams were conducting the census drive in their own area, which is the country's sovereign right.

If such incidents do not stop, Pakistan reserves the right to respond to preserve its sovereignty and protect its civilians, he added.

Prime Minister Nawaz Sharif also condemned the firing as "unfortunate".

"It is the responsibility of the Afghan government to ensure that such incidents are permanently stopped," Sharif said.

The attack came a day after Afghan President Ashraf Ghani turned down Pakistan's invitation to visit the country. The president's deputy spokesperson Dawa Khan Mina Pal said Ghani was invited by Pakistan's Director General Inter-Services Intelligence (ISI) Lt. Gen Naveed Mukhtar and parliamentarians to visit the country.

The two nations are divided by the Durand Line, a 2,400 km frontier drawn by the British in 1896 and disputed by Kabul, which does not officially recognise it as an international border.