The Pakistani intelligence agency (ISI, or Inter Service Intelligence agency, (a combination of military intelligence and CIA activities) is the cause of most of the Islamic terrorist mayhem inside Pakistan. No one in Pakistan likes to talk about this out loud, but everyone discusses the details among themselves after each horrendous attack. The most recent major attacks have killed over a hundred policemen and civilians after suicide bombers attacked police facilities in the tribal territories. These murders were later claimed as revenge for the recent death of Osama bin Laden.
These attacks were carried out by one of the most active Islamic terror groups in the country, Tehrik i Taliban Pakistan (TTP). This, the "Pakistan Taliban" (or most of the Pakistani Taliban) is actually a coalition of 13 Islamic radical groups that joined together in late 2007, after the Pakistani government crackdown on Islamic radical groups that were attempting to establish Islamic rule in urban areas. The subsequent violence has since killed over 4,000 people.
It all began when the government launched its offensive with an attack against the Red Mosque in Islamabad (the capital), to root out radicals who threatened kidnappings and attacks in the capital if their version of Islamic law was not imposed on the city. The Red Mosque had been a center of Islamic radicalism since the 1970s, but by 2007, it was attempting to impose its own hard core lifestyle rules on the population, and the government. The attack on the mosque caused many Islamic radical groups to respond by openly declaring war on the government.
This soon brought the army into the tribal territories, where most of the Islamic terror groups were based. Thus while 190 Pakistani troops were killed (mostly by Islamic radicals) in 2006, this jumped to 427 in 2007, and 952 in 2009 (when the army chased Islamic terrorists out of most parts of the tribal territories.) Last year, the army lost 365 troops to this terrorist violence, as it again tried to work out a peace deal with the radical groups. This has failed, and terrorist related deaths among soldiers is headed for over 700 this year.
The ISI had helped create many of the Islamic radical groups that came to form TTP, but has publicly denied continuing to support them. To the government, the ISI insists that its contacts with Islamic radical groups are for collecting information, and influencing them. Most government officials do not believe this. Back in late 2008, the newly elected civilian government in Pakistan began an effort to dismantle the pro-Islamic radical elements in the ISI. This effort was only partially successful, even though it began in earnest right after the November, 2008 terror attack in Mumbai that nearly started another war between Pakistan and India. That's because one of the terrorists was captured alive (that was not part of the ISI plan) and it was quickly discovered that ISI was a major player in setting up the attack.
Four months earlier, the U.S. had accused ISI 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 details to the media. This was one of many instances where ISI had 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 under ISI direction and protection for three decades. This began with a daring new government policy in the late 1970s, when it was decided that Islamic conservatism was the solution for Pakistan's problems (corruption and religious/ethnic conflicts.) It turns out that there were a lot of Pakistani intelligence professionals that believed in Islamic radicalism, and that has not changed over the decades.
It wasn't always that way. The ISI was created in 1948 as a reaction to the inability of the IB (Intelligence Bureau, which collected intelligence on foreign countries in general) and MI (Military Intelligence, which collected intel on military matters) to work together and provide useful information for senior government officials. The ISI was supposed to take intel from IB and MI, analyze it and present it to senior government officials. But in the 1950s, the government began to use the ISI to collect intel inside Pakistan, especially on those suspected of opposing the current government. This eventually backfired, and in the 1970s, the ISI was much reduced by a civilian government. But when another coup took place in 1977, the new military government decided that religion was the cure for what ailed the country.
Typically, the Pakistani generals seized control of the government every decade or so, when the corruption and incompetence of elected officials becomes too much for the military men to tolerate. The generals never do much better, and eventually there are elections, and the cycle continues. The latest iteration began in 1999, when the army took over, and was voted out of power nine years later, pretty much on schedule. 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 this time around. Then again, recent attempts 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. 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) and left in 1989.
The Soviet Union collapsed two years later, and the Afghan factions 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 rough 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 southwestern 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 this treason.
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. On May 2nd, the U.S. did just that, to kill Osama bin Laden, much to the consternation of the ISI.
Pakistan wants continued U.S. military aid to bolster its defenses against India. But if it suddenly has a hostile U.S. in Afghanistan, and less (or no) military aid, it's general military situation will be, well, not good. While Afghanistan, and the foreign troops there, are dependent on Pakistani ports and trucking companies for supplies, Pakistan is also dependent on the U.S. Navy for access to the sea. Pakistan does not want to go to war with the United States in order to defend Islamic terrorists it openly says it is at war with. Pakistan is being forced to destroy the Islamic radical movement it has nurtured over the last three decades, although it's still questionable if there's enough political will in Pakistan to actually do the deed. The international condemnation of Pakistan-based Islamic terrorists responsible for the recent Mumbai massacre has put Pakistan in a difficult position. If the Islamic radical groups in the country are not really shut down, Pakistan risks be branded a terrorist state.