When gunmen from the Pakistani Taliban stormed an army-run school in Peshawar on Tuesday and killed 145 people, including 132 children, they had two aims: to inflict maximal suffering on the people, and to remind political leaders that the Taliban would not stop shooting and bombing until the Pakistani government was overthrown and a purist Islamic regime was put in its place. The scenes from Peshawar are just the latest example of Pakistan's descent into terrorism and sectarian violence—all despite recent elections, billions of aid dollars, and millions of young Pakistanis' hunger for change.

But the country’s problem goes deeper than the Taliban. There is political and religious space in Pakistan for groups like the Taliban to operate unharmed, the result of decades of government financing and exporting of terrorism abroad and aggressive Islamization at home. The country’s moment of reckoning has arrived, and both the political and religious establishment will now need to confront the conditions that allowed the Taliban to enter a school and murder children.

The Pakistani Taliban, known as Tehrik-i-Taliban Pakistan or the TTP, is a loose network of groups formed in 2007. Unlike their Afghan Taliban brethren, who have been amenable to negotiations (and condemned the Peshawar attack), the Pakistani Taliban reject all solutions short of violence. When Islamabad attempted to negotiate with the TTP earlier this year, the Taliban came to the table but continued attacking. The Pakistani Taliban is especially nihilistic for a jihadist group—killing polio workers, throwing acid in the faces of schoolgirls, and almost detonating a bomb in Times Square. “We don’t like to be involved with them,” an Afghan Taliban spokesman told The New York Times, referring to the TTP. 

Part of the problem, however, is the Pakistani government’s well-known use of terrorism as a foreign policy tool. Under a military doctrine knows as “strategic depth,” Pakistan’s military-intelligence complex has been supporting terrorist groups in Afghanistan and India as an insurance policy against what they call the Indian threat. Hamid Gul, former head of the ISI, Pakistan’s intelligence agency, allegedly met with the Taliban repeatedly, even once telling them to “set Kabul aflame.” The ISI supported and funded the 2008 attack in Mumbai. When teenagers infiltrated and murdered civilians in Kabul’s Serena Hotel this year, Afghan President Hamid Karzai blamed the attacks on “an intelligence service outside this country.” These terrorist plots are allegedly hatched in the ISI’s secretive, off-the-record S-Wing. When a government coddles and finances terrorist groups for this long, it is only a matter of time before the jihadists start attacking their masters and eventually their fellow citizens.

It was not always so. In the 1970s, Pakistan was a fairly liberal society. When Paul McCartney landed in Pakistan in 1964, he was swarmed. That there was once a vibrant Jewish community in Karachi has all been forgotten. The same Peshawar where militants roam freely was even once part of the famous ‘Hippie Trail’ that brought adventurous Westerners to South Asia. Muhammad Ali Jinnah, a barrister trained in England who founded what was then named the Dominion of Pakistan, told his newly independent nation: “You are free to go to your temples. You may belong to any religion or caste or creed.” This imagined community of liberal Muslims has been extirpated in favor of a conservatively Islamic state.

While successive Pakistani governments supported terrorist groups, so they also embarked on the politically expedient but morally criminal mission of Islamizing the country, transforming Pakistan from a state for Muslims into a Muslim state. Alcohol was banned, a parallel Sharia system of justice was instituted, interest was abolished, amputation became the punishment for theft, adulterers were stoned, women who were raped were tried for adultery, and blasphemy became punishable by death. Thousands of madrassas were created to indoctrinate the youth while intolerant lies made their way into official school textbooks. Even the country’s name was changed to the Islamic Republic of Pakistan in 1973.

An entire generation was born into a society coarsened by years of religious fundamentalism where it remains a widely-held opinion that Malala Yousefzai is a CIA spy.

None of this is to exonerate the Pakistan Taliban. They are culpable for Tuesday’s deaths and thousands more over the past decade, but the ISI, the political elites, and Sunni religious leaders who have made violent jihadism a fashionable ideology are all accessories to murder.

The late Pakistani political scientist, Eqbal Ahmad, was a vociferous critic of both the colonial powers and the totalitarian, reactionary ideology known as jihadism. He once wrote in Pakistan’s largest English paper, Dawn:

The cult of violence and proliferation of enemies are inherent in ideologies of difference. All express their hate for the Other by organized violence. All legitimize their violence with references to religion and history. In nearly all instances the enemy multiplies.

These words were written in 1999, before 9/11, before the Iraq War, before the overthrow of the Taliban, before the drone strikes that have also killed far too many civilians. The enemy, as Ahmad predicted, has multiplied many times since then. Jihadists prey on the vulnerable and seek invariably to augment their power. When backed by the state, there are no limits to their targets or to their demands. 

Beyond exterminating the Taliban, then, the Pakistani government must put an end to even tacit support for jihadist networks. It must eliminate the madrassas that preach intolerance to young Pakistanis while and must build actual schools for its children. It must stop pandering to ultra-religious fanatics. The ISI needs to be eliminated and replaced by an intelligence agency that will not rot the country. Most important of all, Islam must be removed as state ideology and consigned to the private, spiritual sphere where it belongs.

Anything short of complete reform will once again mask Pakistan’s existential crisis until the next attack. For its future—its children—the country must change.