The U.S. recently accused the Pakistani ISI (Inter Service Intelligence agency) of being directly involved in a recent terror bombing of the Indian embassy in Afghanistan. The accusation not only involved CIA representatives going to Pakistan to present intelligence information directly to Pakistani leaders, but also leaking the event to the media. This was the most recent of many instances where ISI has supported Islamic terrorists, and this time Pakistan reacted by saying they would root out "Taliban spies" in the ISI. The problem is that these Islamic radicals have been operating openly in the ISI for three decades, and were put there by the government in the late 1970s, when it was decided that Islamic conservatism was the solution for Pakistan's problems (corruption and religious/ethnic conflicts.) These guys are not just "Taliban spies," but Pakistani intelligence professionals that believe in Islamic radicalism.
As I see it the only possible, less than all out chaos and war solution, is to empower the many people in Pakistan who remain for secular democracy, and insist that they are strengthened. If not we are going to be at war in a nation of 170 million or more, many of whom are deobandi fanatics.Typically, the Pakistani generals seized control of the government every decade or so, when the corruption and incompetence of elected officials became too much for the military men to tolerate. The generals never did much better, and eventually there were elections, and the cycle continued. The latest iteration began in 1999, when the army took over, and was only voted out of power last year. Civilian governments tend to be hostile to the ISI, and apparently they are going to make a real effort to clear out many of the Islamic radicals in the ISI. But as recent attempt by the government to take control of the ISI backfired when the generals said they would not allow it. Nothing is simple in Pakistan.
The ISI grew particularly strong during the 1980s, when billions of dollars, most of it in the form of military and economic aid, arrived from the oil-rich Arab governments of the Persian Gulf. All this was to support the Afghans who were resisting a Russian invasion (in support of Afghan communists who had taken control of the government, and triggered a revolt of the tribes). The Afghan communists were atheists, and this greatly offended Saudi Arabia, and other Arab countries, who feared that Russia would encourage Arab communists to rebel elsewhere. So the resistance to the Russians in Afghanistan was declared a holy war which, after a fashion, it was. After about nine years of fighting the tribes, the Russians got tired of their slow progress (and more pressing problems back home, like the collapse of their economy from decades of communist mismanagement).
The Russians were gone by 1989 (and the Soviet Union collapsed three years later), but the Afghans promptly fell upon each other and the civil war seemed never-ending. This upset Pakistan, which wanted to send millions of Afghan refugees back home. Few of the refugees were interested as long as Afghans were still fighting each other. So the ISI created its own faction, the Taliban, by recruiting teachers and students from a network of religious schools that had been established (with the help of Saudi Arabian religious charities) in the 1980s. The most eager recruits were young Afghans from the refugee camps. The Taliban were fanatical, and most Afghans were willing to support them because they brought peace and justice. But the Taliban never conquered all of Afghanistan, especially in the north, where there were few Pushtun tribes (most Taliban were Pushtuns, from tribes in southern Afghanistan). The Pushtuns were about 40 percent of the population, and had always been the most prominent faction in Afghanistan (the king of Afghanistan was traditionally a Pushtun.)
Although a military junta was again running Pakistan when September 11, 2001 came along, the president of the country, an army general (Pervez Musharraf), sided with the United States, and turned against the Taliban. But many in the ISI continued to support the Taliban, and the army was too dependent on the ISI (for domestic intelligence, and to control Islamic militants that were attacking India, especially in Kashmir) to crack down on the ISI.
Al Qaeda took this betrayal badly, and declared war on the Pakistani government. The ISI was used to seek out and kill or capture most of the hostile al Qaeda operatives in Pakistan. But the ISI insured that Islamic terrorists who remained neutral were generally left alone. The ISI thwarted government efforts to have the army clear the al Qaeda out of the border areas (populated largely by Pushtun tribes, there being more Pushtuns in Pakistan than in Afghanistan). But now, in one sense, it's September 11, 2001 all over again. The U.S. has told Pakistan that it is fed up with getting screwed around by the ISI, and if Pakistan doesn't clean out the ISI, and shut down Islamic terrorists along the Afghan border, NATO, U.S. and Afghan troops will cross the border and do it.