Four Pakistani soldiers were killed and six others were wounded along the Pakistan-Afghanistan border on Wednesday in an ambush by militants from Afghanistan, Pakistan's military said, as the soldiers were doing controversial border fencing work.

The soldiers were working on fencing along the border in Zhob district, an area of Pakistan's Baluchistan province, the military said in a statement. Zhob sits across from Afghanistan's eastern Paktika province.

Officials in Afghanistan did not immediately reply to a request for comment.

Pakistan has said it is constructing a fence along its 2,500 km (1,500 mile) frontier with Afghanistan to secure the area, despite Kabul’s protests that the barrier would divide families and friends along the Pashtun tribal belt straddling the colonial-era Durand Line drawn up by the British in 1893.

Security forces from the two countries occasionally exchange fire along the disputed border. In July 2020, at least 22 people were killed as crowds waited to enter Afghanistan from Pakistan at a border crossing, with both Pakistani and Afghan soldiers exchanging fire.

In April a car bomb at a luxury hotel in the city of Quetta, the provincial capital of Baluchistan, killed four people, in an attack later claimed by the Pakistani Taliban. China's ambassador to Pakistan was staying at the hotel, but was not present during the attack.