Afghan authorities have returned the bodies of five Pakistani soldiers killed during a weekend clash along a disputed sector of the two countries' border, and also released a sixth soldier captured by the Afghans, Pakistan's Foreign Office says.

Islamabad had described the clash as an attack on a Pakistani border post in the Kurram tribal region, saying it was carried out by Afghan forces and tribesmen.

Muhammad Faisal, a spokesman for the Foreign Office, said the two sides resolved the issue of the incident through "diplomatic and military channels."

Initial reports had said the Pakistani Frontier Corps troops were carrying out "routine surveillance" when they were "fired upon from the Afghanistan side," leaving two dead and five wounded.

The Afghan police said the clashes erupted after Pakistani forces crossed into Afghanistan.

Separately, three Afghan election workers and two police officers, who were kidnapped in Ghor Province on April 17 by militants, were freed, police said.

With reporting by AP