ON JANUARY 20, a group of men from the militant Islamist group Tehrik-e-Taliban Pakistan infiltrated the campus of Bacha Khan University in northwestern Pakistan. Armed with assault rifles and grenades, they managed to kill over 20 students and faculty before they were gunned down by local security forces.

The attack managed to shock a country that for years has endured terrorist outrages. That the killings occurred at a university, targeting innocent students and teachers, made them feel particularly heinous. But the attack was also remarkable because Pakistan, for more than a year, had appeared to be on the way to finally defeating its homegrown insurgency. And despite the horror of what happened at Bacha Khan, that still seems to be the case.

Last year saw precipitous decreases in both terrorist attacks and fatalities in Pakistan. Though exact figures differ, statistics compiled by the South Asia Terrorism Portal, the research arm of the New Delhi-based Institute for Conflict Management, as well as a study by the Islamabad-based Center for Research and Security Studies, a pro-democracy think tank, showed significant decreases in violence in the country. A CRSS study said terrorist incidents declined 56 percent in 2015 from 2014, and the SATP, which conducts a running tally of terrorism figures, said that Pakistan in 2015 suffered the lowest number of suicide attacks and deaths from terrorism since 2006.

These reported declines follow Pakistan’s¬†initiation in 2014 of a large-scale¬†military¬†operation¬†against¬†Taliban sanctuaries in¬†the ungoverned tribal areas¬†bordering Afghanistan. That¬†effort, which is ongoing, has succeeded in reclaiming most territory in the tribal areas.

The seven years preceding this¬†operation coincided with the escalation¬†of the American war in Afghanistan and were among the bloodiest in Pakistan’s¬†history. Those years saw a deluge¬†of terrorist attacks that targeted¬†markets, shrines, mosques, and major landmarks throughout the country. Suicide bombings, once unprecedented in Pakistan, suddenly became a gruesome regularity. Even widely revered religious sites¬†were not immune. As a seemingly unstoppable wave¬†of attacks overtook¬†the country, landmarks¬†like Lahore’s Data Darbar complex and Karachi’s Abdullah Shah Ghazi shrine, both popular destinations for Sufi¬†pilgrims from across South Asia,¬†were struck by suicide bombings. The violence called¬†into question the government’s¬†ability to maintain domestic cohesion.

By 2014, the situation had begun to look dire. The tipping point finally came on June 8, when a group of TTP¬†militants¬†launched an¬†attack against Karachi’s Muhammad Ali Jinnah International Airport, killing 28 and threatening to sever the major¬†transit link between Pakistan’s economic¬†capital and the rest of the¬†world.

The following week, the Pakistani military commenced the large-scale¬†attack on Taliban sanctuaries, known as Operation Zarb-e-Azb. In a public¬†statement¬†announcing the start of the campaign, the government painted the battle in existential terms, saying that the militants had “waged a war against the state of Pakistan” and¬†that their terrorism was “disrupting our national life in all its dimensions, stunting our economic growth and causing enormous loss of life and property.”

Over a year and a half later, Operation Zarb-e-Azb appears to have garnered results. In addition to sharp statistical¬†declines in terror attacks and casualties, locals¬†in major urban centers like Karachi have also¬†reported improvements in¬†basic¬†law and order. According to figures compiled last year by the Human Rights Commission of Pakistan, an independent nonprofit, sectarian violence and so-called target killings¬†in Pakistan’s largest city declined by¬†28 percent and 63 percent, respectively, from the previous year.

“The most critical factor behind the reduction in terrorist¬†violence is the North Waziristan operation,” i.e., Operation Zarb-e-Azb, says Arif Rafiq, an adjunct¬†scholar¬†with the D.C.-based think tank Middle East Institute. “The TTP and other terrorist groups were cleared from their last remaining stronghold in the tribal areas. There were also intensifying operations in Karachi and northern Baluchistan, where these militants would go to hide, and where there have been preexisting security challenges.”

“The militants still exist in pockets across the tribal areas, but in small numbers,” he adds. “The remnants of the groups are¬†now either dead or in Afghanistan.”

The tribal areas bearing the brunt of the military effort have been subject to an unprecedented media blackout, with reporting from the region effectively banned by the government. There have been allegations of human rights abuses by Pakistani forces during the campaign, including summary executions, aerial and artillery bombardment against populated areas, and the improper use of military tribunals to deliver civilian justice. The onset of Operation Zarb-e-Azb also triggered a massive internal refugee crisis, with upwards of half a million people fleeing to other parts of the country.

“The gains in security have been partially due to the use of tough methods that don’t conform to mainstream human rights standards,” says Rafiq. “There is a media blackout, and we don’t know what we don’t know. At the same time, I would venture to guess that though the lives of locals in North Waziristan and elsewhere in FATA [Federally Administered Tribal Areas]¬†have been upended, many probably look forward to a future without jihadists in their midst.”

Pakistanis have long been reluctant to go to war against militant groups in the tribal regions, seeing such an effort as lending support to an unpopular U.S.-led war in neighboring Afghanistan. But the past few years of violence in Pakistan, in which many of those same militant groups turned their guns on Pakistanis themselves, has altered these sentiments.

Following a particularly heinous massacre by TTP insurgents against a school in Peshawar last year, Pakistan’s¬†fractious military and civilian leadership agreed to pass a raft of punitive counterterrorism¬†policies to intensify¬†the fight against the militants. Among these were¬†the reintroduction of¬†the death penalty for convicted terrorists and the authorization for¬†civilians to be tried by special anti-terrorism courts. These measures have drawn criticism from local human rights organizations, while also potentially¬†undermining¬†Pakistan’s democratic institutions for the sake¬†of wartime expediency.

In the long term, however, given the scale of terrorist violence in Pakistan, which far outpaces that in the U.S., strengthening and extending the reach of democratic institutions, while cutting support to terrorist proxies, may be the only way to prevent militant groups from reconstituting themselves.

In its short history, Pakistan has several times found¬†itself going to war¬†to maintain sovereignty over parts of its own territory. One such failed campaign resulted in the wholesale secession of¬†the eastern half of the country, while another battle against separatist guerrillas in the province of Baluchistan continues to rage to this day. The growth of militant and separatist¬†movements¬†in the¬†provinces¬†has long been a consequence of Pakistan’s failure to¬†economically and politically integrate these regions with the central government.

In the tribal areas¬†in particular, the local population has long suffered from chronic underdevelopment by the state. Nearly¬†70 years after Pakistan’s creation, a significant portion¬†of these regions are still governed by absurd British-era laws that trample on¬†individual rights and freedoms, rendering their inhabitants¬†less like citizens than colonial subjects.¬†In such an unjust environment, even widely loathed extremist groups like the TTP will¬†inevitably find recruits.

As noted by Georgetown University fellow Claude Rakisits in¬†the 2011 book¬†Pakistan’s Stability¬†Paradox, “A critical factor that has assisted the growth of this militancy is the failure since the creation of Pakistan to integrate FATA¬†politically, legally and economically with the rest of the country.”

Military force may now succeed in achieving a temporary victory in Pakistan’s fight against terrorism. But providing development, legal rights, and political enfranchisement to the residents of the tribal areas will be necessary to ensure that¬†the battle against the TTP¬†and other extremist groups will¬†truly come¬†to an end.