KHOST, Afghanistan (Reuters) - Afghan tribesmen on Monday returned a Pakistani soldier they captured in a deadly skirmish along the countries’ border, as well as the bodies of five soldiers, the governor of Afghanistan’s Khost province said.

The soldier and the bodies were handed to Pakistani troops, said Khost governor Hukum Khan Habibi.

The dispute arose over Pakistan’s work on a fence intended to span nearly all of the disputed 2,500-km (1,550-mile) border, much of it mountainous and porous. Afghan officials have alleged that Pakistani troops crossed onto Afghanistan soil, prompting firing on Sunday by border forces and the local tribal force.

The two sides later agreed on a ceasefire.

Border skirmishes in the area are common, although detention of a foreign soldier is rare. Each national government alleges that the other allows sheltering of Taliban militants who stage cross-border attacks.

The tribesmen handle security in their Zazi Maidan district of Khost.

The Pakistani military has previously said that two of its soldiers were killed. An Afghan army commander has said two tribesmen were killed in the skirmish.

A spokesman for the Pakistani military could not be immediately reached.