May 17, 2018, 9:10 AM UTC / Updated May 17, 2018, 9:13 AM UTC

ANGUR ADDA, Pakistan — Pakistan is spending around $483 million to build chain-link fences along its porous 1,500-mile border with Afghanistan.

The project aims to curtail the flow of terrorists between the two countries. It follows a yearslong Pakistani military push aimed at dismantling militant networks in its restive tribal North and South Waziristan regions.

“For the better security of our country and nation, we had to do this work,” a Pakistani army official, Brig. Nisar, who uses only one name, told journalists during a government-organized visit to the border this month.

The barrier has angered the Afghan government, which disputes the location of the boundary and says the fence will tear communities apart.

Construction began last year on two fences that parallel each other as they snake through the remote, mountainous landscape. Standing 13 feet high on the Afghan side and 11 feet on the Pakistani side, sharp spirals of silver barbed wire are cradled at the top of each.

A portion of the fence near Quetta in Pakistan's Balochistan province. Banaras Khan / AFP - Getty Images

Additional coils of barbed wire have been placed on the ground in the gap between the fences, which are dotted with Pakistani military towers.

The military says it will have 92 percent of the national border fenced before the end of 2019.

However, only three miles of the 789-mile stretch of the border along the remote southwestern province of Balochistan has been fenced so far, according to a military official who spoke to NBC News on the condition of anonymity.

Beyond Balochistan, Pakistani authorities said the other part of the fence, including the portion visited by NBC News, would eventually total 516 miles in length. Around 146 miles of that stretch has been completed, according to officials.

Some parts of the border will not be fenced as they are too mountainous.

Pakistan alleges that Islamic State terrorists are using Afghan territory to plan attacks and accuses Kabul of not doing enough to secure the border.

Pakistani security officials told NBC News that while Pakistan has 64 security fortifications and posts in one 112-mile stretch of the border, Afghanistan has built only eight.

A Pakistani army soldier stands guard along with border fence. Banaras Khan / AFP - Getty Images

Afghanistan has long disputed the location the border, which was established by British colonizers in 1893.

“The current border is not accepted throughout history. This is a critical issue,” said Mohammad Yaqub Ahmad Zai, Afghanistan’s deputy minister of border and tribal affairs.

One of the main concerns for Afghanistan, however, is that the project will separate families and rip apart communities who have been able to cross freely for centuries.

“Tribes living on both sides are brothers,” Zai said. “They are one family. You can’t separate them by fencing.”

Mushtaq Yusufzai and Wajahat S. Khan reported from Angur Adda, Ahmed Mengli from Kabul, and Francis Whittaker from London.