NORTH WAZIRISTAN, PAKISTAN — Pakistan is building a border wall with Afghanistan, after decades of unsuccessfully controlling the flow of terrorists and criminals who quietly slip back and forth across the porous 1,500-mile border between the two countries, evading capture.

The wall is not concrete, but consists of a comprehensive border system that includes two layers of 12-feet-tall barbed-wire fencing, surveillance cameras, solar lights, an intrusion detection system, and hundreds of manned forts and thousands of observation posts. It is scheduled to be completed by the end of 2019.

Last week, Breitbart News and two other news outlets were escorted by the Pakistan military into the country’s Federally Administered Tribal Areas (FATA) to one fort along the border near the Pakistani village of Miran Shah and just about 20 miles from Khost, Afghanistan – once considered a terrorist hotbed.

There, shiny double-layered fencing could be seen zigzagging the hilly terrain for miles between observation posts, spaced two to three miles apart. They are currently being manned by the Pakistan Army Frontier Corps.

Pakistan’s top military officer, Gen. Qamar Javed Bajwa, conceived of the idea when he took command in November 2016 as Pakistan’s Chief of Army Staff. Construction began last June.

According to the Pakistan military’s top spokesman, Maj. Gen. Asif Ghafoor, it has “phenomenally reduced the unchecked border crossings.”

The fence is being constructed at a critical time between U.S. and Pakistan relations.

Pakistan has come under increasing pressure from the U.S. to stop militants in Afghanistan from seeking safe haven in Pakistan. Last year, the U.S. sent an additional 4,000 forces to Afghanistan and in January, the Trump administration announced the cutting of security assistance to Pakistan.

Throughout the 17-year-war, militants have launched attacks against U.S. and Afghan forces in Afghanistan, then melted into the mountainous terrain of the FATA, a semi-autonomous tribal region that makes up roughly a third of Pakistan’s border with Afghanistan.

Former head of Al Qaeda, now deceased Osama Bin Laden, evaded ten years of capture after masterminding the 9/11 attacks from the border region and then slipping quietly into Pakistan, where he lived in a compound in Abbottabad, about 75 miles north of the capitol of Islamabad.

Although Pakistani officials deny knowing he was there, it further soured trust between U.S. and Pakistan and increased American suspicion that Pakistan was playing a double game of pledging help but looking the other way on terrorists.

At the behest of the U.S., Pakistan has cracked down on terrorists in this region, but with uneven success, facing heavy backlash from terrorists. On December 26, 2014, Tehrik-i-Taliban militants — commonly referred to as the “Pakistan Taliban” — struck an Army-run public school in northwest Pakistan, killing 132 children.

In 2014, the Pakistan Army launched its largest counterterrorism operation to date, dubbed Operation Zarb-e-Azb. In the FATA, that has meant some villages like Miran Shah have been almost completely leveled, in order to root out tunnels terrorists used to hide and store caches of weapons. The city is in the process of being rebuilt and renovated.

Since the operation began in 2014, the security situation has improved, and Pakistani leaders are eager to capitalize on that success — by building the fence, cracking down on terrorists, and urging an end to the war next door.

Pakistan officials see hope in recent peace overtures. Afghan President Ashraf Ghani recently offered peace talks to the Taliban, who have expressed some interest but are reluctant to enter into talks unless the U.S. is directly involved.

The U.S. has so far declined direct talks with the Taliban, urging an Afghan government-led process. Pakistani officials are imploring Americans to enter talks or consider restarting the Quadrilateral Coordination Group, which involved the U.S., Afghanistan, Pakistan, and China.

Defense Secretary Jim Mattis expressed support for political reconciliation during an unannounced visit to Afghanistan this week, but he reiterated the U.S. position that the talks would be Afghan-led and not directly with the Taliban.

Still, Pakistani officials are hopeful that Ghani’s offer is a turning point, and Pakistan can emerge from the specter of terrorism plaguing their country. They say more than 80,000 Pakistanis have been killed by terrorism.

For Pakistan, the wall is a symbol that enough is enough.

Pakistani officials say previous efforts to control the border have not been easy, for several reasons.

For one, the border, drawn by the British in 1896, cut across tribes and families. For example, Miran Shah is divided into three sub-divisions, which are divided into 15 sub-tribes, some of which span both sides of the border.

“Many of the sub-tribes live close to the border, but also across the border,” said Pakistan Army Brigadier-General Jawad, commander of forces in Miran Shah.

Pakistani officials say locals have exploited easement rights that were granted after the border was drawn, and admit they have been lenient on them.

Another challenge has been the complexity of the terrain, which includes vast stretches of mountain ranges, some as high as 11,500 feet. Patrolling the mountains is a costly endeavor, and the Pakistan Army is split between its border with Afghanistan and its border with India, particularly in the Kashmir region.

Another difficulty has been the lack of cooperation — and capacity — from Afghan officials. Afghanistan does not formally accept the border, and has resisted any formal demarcation.

“There is no corresponding border management on the other side,” said Pakistan Army Maj. Gen. Nadeem Anjum, inspector general of the Frontier Corps in Balochistan. “It is almost unilaterally managed.”

Pakistan is planning to build seven times more observation posts than Afghanistan along the border. Officials say the posts on the Afghan side will be clustered together, leaving large gaps in between.

Then there is the sheer enormity of the border crossings.

At the Chaman border gate in Balochistan, just south of the FATA, a minimum of 20,000 people and 300 to 400 trucks cross per day. And Chaman is just the second busiest border crossing.

There, Pakistani officials say Afghans seeking entry into Pakistan will often present border guards with only a handwritten note from an unknown tribal elder. There is also no system for checking the hundreds of trucks that cross the border.

Given the many challenges, Pakistan officials have decided to build a fence. It is not clear whether they were inspired by President Trump’s campaign promise to build a wall, but a number of Pakistani officials pointed to the U.S.’s difficulty in controlling its border with Mexico.

“So please understand our predicament,” Ghafoor said.

Asked what would happen if a militant drove an armored military vehicle into the fencing, he replied, “There is no obstacle that is non-negotiable.” But, he added, “It’s an effort to discourage them.”

Maj. Gen. Anjum said there have been attempts in Balochistan to breach the fencing, but they have been “unsuccessful.”

The border system will cost Pakistan more than $500 million to build.

Pakistan is also trying to implement a passport and identification card regime by the end of this year. A visa office is planned near Chaman Gate, so that Pakistanis do not have to travel to the capital of Islamabad to obtain a visa.

But in the meantime, the fence will continue being built.

“Fence it. Then manage it,” said Anjum. “It’s the simplest solution in the history of the world.”