QUETTA, Pakistan (Reuters) - Pakistani and Afghan troops exchanged fire for several hours on Friday along their disputed border, officials on both sides said, as tension between the neighbors flared into deadly violence.

Slideshow ( 3 images )

Pakistan’s military said a census team - guarded by troops from its Frontier Corps (FC) - that was collecting population data in a village near the border town of Chaman came under fire and at least one person was killed and 18 wounded.

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”.

“They did not heed the warning and we have clear orders to engage them,” Durani said, adding two Afghan border police were wounded.

Kandahar police chief General Abdul Raziq said 40 Pakistani soldiers and 37 others were killed, including 14 Afghan border police. Reuters was unable to confirm the figures.

Violence ceased later in the day and officials from both sides were due to meet at the frontier, the Pakistani military said. Pakistan’s foreign ministry summoned the Afghan charge d’affaires to protest at what it called unprovoked firing.

The Chaman crossing into Afghanistan’s Kandahar province is one of two border points. A doctor in a Chaman hospital told Reuters three people had been killed in the fighting.

Relations between the countries have been uneasy since Pakistan’s independence in 1947. Afghanistan has traditionally enjoyed better ties with Pakistan’s rival, India.

Afghanistan has for years accused Pakistan of sheltering Afghan Taliban militants, something Pakistan denies.

Pakistan’s military said Afghan border police had been “creating hurdles” since April 30 for the census team in the Chaman area.

“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,” the military said.

Tension has been increasing in recent months with each side accusing the other of not doing enough to stop militants engaging in cross-border raids.

Last year, Pakistan started building a barrier at the main border crossing in the town of Torkham, near the Khyber Pass, angering Afghanistan which has never formally recognized the colonial-era Durand Line border drawn up in 1893.