Pakistan's military has begun fencing parts of its disputed northwestern border with Afghanistan to curb the movement of Pakistani Taliban fighters it says are based on Afghan soil, according to a statement.

Fencing started in the Pakistani Bajaur and Mohmand districts, which border the eastern Afghan provinces of Nangarhar and Kunar, Pakistan's Army Chief Qamar Javed Bajwa announced on Saturday.

Pakistan shares a mountainous and largely unpatrolled 2,500km-long border with Afghanistan, which the latter disputes. Previous attempts to fence or formally demarcate the border have met with resistance from Kabul.

READ MORE: Clashes on Pakistan-Afghanistan border kill 15

In June, at least four people were killed when Pakistan and Afghanistan exchanged artillery fire over Pakistan building a formal border control complex at Torkham, the main border crossing between the two countries.

The clash marked a continuing souring of relations between the South Asian neighbours.

Pakistan sealed all border crossings with Afghanistan in mid-February, during a wave of attacks on Pakistani soil that killed at least 130 people.

Those attacks were followed by frequent skirmishes between Pakistani Taliban fighters and Pakistan's military along the border in the Mohmand, Khyber and other districts.

In the latest such violence, on March 17, at least eight people, including two soldiers, were killed in a Pakistani Taliban attack on Pakistani border posts from the Afghan side of the border.

The border closure remained in place for more than a month, leaving thousands of visitors and tons of perishable goods stranded on either side of the border.

On March 20, Pakistan's Prime Minister ordered the reopening of the border for all traffic "on humanitarian grounds".

Addressing troops deployed on the border in Mohmand and Orakzai districts on Saturday, Bajwa said "technical surveillance means are also being deployed along the border besides regular air surveillance", a Pakistani military statement said.

READ MORE: ISIL expands in Afghan-Pakistan areas, widening attacks

Bajwa said that Pakistan was working with Afghanistan to develop a bilateral border security mechanism.

"A better managed, secure and peaceful border is in mutual interest of both brotherly countries who have given phenomenal sacrifices in war against terrorism," he said.

The Pakistan-Afghanistan border has been at the centre of accusations hurled by both governments against each other.

Pakistan and Afghanistan accuse each other of sheltering elements of the Pakistani and Afghan Taliban respectively.

Both sides deny the charges, although major leaders from both groups have been killed on the others' soil in the past.

Pakistan's military is now building more than 420 "small forts" along the border, and deploying radar sensors to detect cross-border movement, Pakistan's Dawn newspaper on Sunday.

Asad Hashim is Al Jazeera's Web Correspondent in Pakistan. He tweets @AsadHashim