The headquarters of the Pakistani secret services lie hidden behind towering, beige-coloured walls in the old British cantonment of Rawalpindi. Sweeping, arched roofs and sprawling verandas evoke memories of the Raj, as do the street urchins playing cricket outside the gate.
The languid appearance is deceptive. I have come behind the lines in the so-called "war on terror". One of the world's most sinister organisations, the Directorate for Inter-Services Intelligence (ISI) is often seen as Pakistan's invisible government. It has long operated out of the public gaze. During the Soviet occupation of Afghan-istan it funnelled CIA funds to the mujahedin fighters; in the 1990s it bankrolled the Taliban into power. Its links to Osama Bin Laden and al-Qaeda are a matter of record. Yet ISI chiefs now find themselves cast in an unlikely role as the west's policemen, hunting down jihadists in the lawless tribal areas of northern Pakistan.
The only modern nation founded on Islam, Pakistan is a homeland that has failed to work. Now it is teetering on the brink of chaos. The ISI is largely to blame. Late last month, Islamist militants in North Waziristan ambushed a convoy of ISI-led troops, killing seven soldiers and wounding 22. The attack was a reprisal for the killing in a nearby village of seven Qaeda suspects, including Mohsin Musa Matawalli Atwah, an Egyptian on the FBI's list of most-wanted terrorists for his alleged involvement in the 1998 bombings of US embassies in Tanzania and Kenya.
The figures at the top of the ISI are almost pathologically averse to the glare of the media, so it was with some trepidation that I accepted an invitation from Brigadier A-, head of the counter-terrorism section, to discuss a secret operation to stem the "two-way traffic" of terrorists between Pakistan and Britain in the wake of last July's bombings in London. Once, the only civilians permitted to enter this building were suspects, and not all of them made it out alive.
A dapper man in his late fifties, dressed in an immaculately tailored business suit in spite of the heat, the brigadier greeted me with sandwiches, cakes and tea. A bearer wearing a white waistcoat and black wool Jinnah cap served us from a table piled high with documents and newspaper cuttings, plus a stack of empty notepads and other pieces of stationery. (I am ashamed to say I took one of the ISI pencils as a trophy.) A laptop computer flickered with a PowerPoint slide show of images of the World Trade Center engulfed in flames on 11 September 2001.
The brigadier appeared troubled. Hours earlier, a suicide bomber had set off an explosion at a parade in Karachi, killing at least 57 people. The blast happened not far from the site of another bombing in March, in which a US diplomat was killed. Roughly 45 Islamist groups operate in Pakistan. The best-known are Harkat-e-Jihad-e-Islami (Movement for Islamic Jihad), Jaish-e-Mohammad (Army of Muhammad) and Jundullah (Army of God), but with ever-changing names, splits and overlapping ideologies, it is difficult to differentiate between them, let alone keep track of their attempts to replace Pakistan's leadership with a fundamentalist regime.
"There's a lot of work to be done in defeating al-Qaeda," said my host, slumping in his chair. As if to underline the point, helicopter gunships were busy strafing the village, a hundred miles away in North Waziristan, where several Qaeda members, possibly including Bin Laden, are said to be hiding out. Twenty years have passed since Bin Laden led a group of a few dozen men - Saudis, Egyptians, Algerians and Pakistanis, whom he had recruited and trained - out of a cluster of caves in the mountains on the Pakistani frontier. These were the men who would fight the Soviet infidel in Afghanistan.
The brigadier knew every ridge and mountain pass, every CIA trail. He gossiped about these mysterious strangers who have returned to North Waziristan, using a portfolio of disguises and pseudonyms. They still appear to move with ease, travelling between the Pakistani tribal lands and southern Afghanistan - sometimes protected by the Pathan tribes, sometimes by drug barons - in a circle of a few hundred miles, using the same mountain passes and little-known trails as the mujahedin's convoys during the jihad years.
Towards the end of our conversation, Brigadier A- talked of the "Talibanisation" of Pakistan's borderlands. Yet the ISI itself is largely responsible for importing Arab jihadists into the region in the first place. "The United States used to think very strongly that we could just deliver Bin Laden," he said. "But I have been telling everyone, 'We can assist, not assure,' and I think we have been successful in driving that point home."
I asked the ISI chief about his pictures of the twin towers. It seemed odd, given the past role of Pakistan's secret services - no strikes without al-Qaeda, no al-Qaeda without the Taliban, no Taliban without the ISI - that they would peddle this mawkish nostalgia. The brigadier peered from behind his glasses, and smiled. "If you say the ISI alone is responsible for 9/11, I would have an objection to that. I think Pakistan was responsible. I think the free world as a whole was responsible for 9/11. When the Soviet Union was defeated, the money was coming from all over the world, from Egypt, the Middle East, south-east Asia. A lot of these people would have conflicted, but the world just melted away, and we had no choice. We have always supported any government in Kabul, but the Taliban would have come to power with or without the ISI. We joined the train after it had started, but a lot of people thought it was a force that could bring some kind of stability to Afghanistan."
As I left the brigadier's office, I recalled that Pakistan's military ruler, General Pervez Musharraf, once called the army his country's "last institution of stability". Yet the tension is rising. After the protests against the Danish cartoons of the Prophet, he went on television to declare that his government would stand shoulder to shoulder with the mullahs against the "sacrilegious acts" of the west. "The entire nation and the Umma [Muslim community] is unanimous," he said, but warned that "antisocial and criminal elements" were responsible for torching a KFC restaurant, a Norwegian phone office and other western-linked businesses.
Visibly pale, blinking and sweating, the general looked like a man who knew the game was up. Pakistan is a dictatorship run by the army, whose intelligence wing sponsored terrorism in Afghanistan and Kashmir until Musharraf's 180-degree policy turn in the wake of 11 September 2001. Until now, army discipline has managed to contain opposition to his deeply unpopular alliance with President George W Bush. However, the cracks are beginning to show, and the pact between the US and India on nuclear energy, agreed in March, makes things worse. "Musharraf is on losing ground," a senior figure in the government told me as protests spread to Islamabad, and even the former cricket star Imran Khan was placed under house arrest.
Yet the demonstrations are not quite what they seem. In Islamabad, the most militarised city, a bunch of school students managed to storm the diplomatic compound, where they proceeded to throw stones at European embassies and smash envoys' cars. Musharraf loyalists acknowledge that the government sometimes permits religious parties, including the fundamentalist Jamaat-e-Islami, to let off steam. But the complicity may be different this time. So who are the "antisocial elements" stoking the violence? Many leading Pakistani politicians feel that the riots are being orchestrated by the army itself.
"Musharraf is responsible for this violence. He gave the orders for the riots to begin, for political reasons, and the army helped to stage the protests," said Amanullah Kamrani, a senator from the western province of Balochistan. "The general knows that he is losing power and so he's using the riots to send a warning to the west - as if to say, 'Look, I'm the only person saving the country from Muslim extremism.'"
Musharraf's recent behaviour seems to bear this out. At a meeting with Hamid Karzai in February, both he and the Afghan president affirmed their determination to see "enlightened moderation" (Musharraf's catchphrase) triumph over radical Islam, and Prime Minister Shaukat Aziz was beating the same drum to any foreign visitor who would listen. "Pakistan joined this effort to fight terrorism from its own conviction, not to please anybody, because terrorism knows no borders. There are no good terrorists or bad terrorists. Terrorism hurts everybody," the prime minister told me during an interview at his official residence in Islamabad.
The trouble is that the best-laid plans of the Pakistani army and the ISI often go awry. For decades, Delhi has been protesting about Pakistani-backed infiltration into Indian-administered Kashmir. Several times the two nuclear-armed nations have gone to the brink of war, but stepped back. At the end of 2001, gunmen allegedly linked to the ISI-funded Jaish-e-Mohammad attacked the Indian parliament building in Delhi, killing 12 people. For six months the world looked on as Islamabad and Delhi traded ultimatums and threats, but then the world's longest unresolved conflict lapsed into paranoid inertia, the signature condition that is just one of Kashmir's many betrayals, as Salman Rushdie notes in his novel Shalimar the Clown.
By supporting jihadist groups in the disputed territory, Pakistan's generals, who have governed the country since a coup d'état in 1999, hope to advance what they regard as a righteous cause, and to pressure India's government to negotiate over the future of Kashmir, divided after the partition of the subcontinent in 1947. After the Kashmir earthquake last October, tensions all too briefly took second place to reconstruction efforts.
Kashmir's mountains rise between 4,000 and 7,000 feet above sea level, and mark a tectonic inter-section that was almost visible to the eye as I flew over the earthquake zone in a Puma helicopter. The Pakistani army's sluggish response to the disaster may be explained by the inhospitable terrain, or by its own heavy losses in the area where the quake hit. According to an army spokesman, 450 officers and soldiers died on the road to Muzaffarabad, capital of what Islamabad calls "Azad Kashmir" (meaning "Free Kashmir"), the part that Pakistan controls.
The helicopter zigzagged across the Neelum Valley, where landslides had sealed off the canyons and blocked the only road. In many places, the sides of mountains had fallen away, as if sliced off with an axe. In the villages below, hundreds of people wandered aimlessly between the piles of rubble, clutching photo-graphs of relatives or bundles of food and clothing distributed from the valley's relief depot, which is supplied by air.
For the past 15 years, the Pakistani army has supported rebellion on India's side of the Line of Control by aiding violent Islamist groups, some of them with ties to al-Qaeda, which are seeking to unify all of Kashmir with Pakistan. One of the most prominent of these groups has been Lashkar-e-Toiba (Army of the Pure), which the Bush administration designated a foreign terrorist organisation in 2001.
The feuding in Kashmir goes back a long way. In 1947, Pakistan was carved out of British India, which had more than 500 princely states; one of them, the predominantly Muslim Kashmir, was ruled by a Hindu maharaja who could not decide whether to join India or Pakistan. In October that year, tribesmen from Pakistan's North-West Frontier Province invaded Kashmir, arriving in British trucks. That hastened the maharaja's decision to join India, which quickly responded by airlifting troops into the area.
After the quake, Musharraf launched a fresh peace offensive. "Let success emerge from the tragedy," he said. Yet even his main spokesman, Major General Shaukat Sultan, has conceded that efforts to demilitarise the borderlands have failed. "We want to seize the opportunity - open the Line of Control and let people move freely. But unfortunately the movement from the other side is not fast enough. That is what is discouraging for us," he said.
As a result, Kashmir remains mired in conflict. The causes of the 2002 Indo-Pak crisis - jihadist terrorism, mutual suspicion and a relatively young, unstable system of nuclear deterrence - have not disappeared. If anything, the pace of terrorist attacks has quickened. In Kashmir, as in Afghanistan, Pakistan's intelligence services have found that controlling Islamists is an inexact science.
One example is Lashkar-e-Toiba. This was (and still is, depending on whom you ask) a radical jihadist organisation that has carried out persistent and sometimes spectacular attacks against Indian targets, both military and civilian, in Kashmir and elsewhere. Under US pressure, Musharraf banned Lashkar-e-Toiba in early 2002, but he allowed it to create a domestic charity under another name, Jama'at-ud-Da'awah (the Preaching Society), with the same leader. The new group runs conservative madrasas and promotes an austere vision of Islam through its preaching and social work, and, according to a spokesman, it has hundreds of thousands of members throughout Pakistan. Azad Kashmir had been an important base for Lashkar-e-Toiba, offering sanctuary and a convenient launching ground for anti-India operations.
Less than a mile from the main Jama'at-ud-Da'awah camp in the Azad Kashmir capital, the US army has erected a field hospital. US Humvees on a break from chasing remnant Qaeda elements in Afghanistan share the streets of Muzaffarabad with ambulances from the Rashid Trust, a charity whose funds were blocked by the Bush administration in 2001, following accusations that it had assisted al-Qaeda. Musharraf's position has been perilous ever since. In 2003, for instance, a fighter from Jaish-e-Mohammad, a group that the president had singled out, tried to assassinate him. The success of jihadist groups in providing earthquake relief has strengthened their claims to legitimacy in Pakistan.
The difficulty for Musharraf is that a country run by a military dictatorship with tacit links to terrorism does not seem the best advertisement for "enlightened moderation". Now many of the general's backers in the White House also see it that way. The government in Islamabad is becoming an embarrassment to its sponsors in the west.
Tension increased just before Bush's visit to Delhi in early March. Some Pakistani hard-liners fear the US-India nuclear technology deal could lead to Pakistan losing the strategic advantages it gained from signing up to the "war on terror". Among the conspiracy theories swirling around Islamabad was a senior minister's hint that the CIA might even be the hidden hand behind the anti-Musharraf demonstrations. He suggested that Pakistan's nuclear capability was to blame and said the US leadership could not tolerate a nuclear-armed Pakistan that was also stable; it therefore felt obliged every three or four years to do something to destabilise the country. The protests in the streets of Lahore and Karachi were just the latest example of US "dirty tricks".
Pakistan's leaders fear the loss of status that would ensue if others develop nuclear capability. Where Iran might go, Saudi Arabia, Syria or Egypt might follow. "Being a nuclear power bestows kudos in the Muslim world," a leading minister told me. "We don't say it out loud, but it's a fact. The nuclear powers are a club apart and so we don't want Iran or any other Muslim country to become a nuclear power."
Yet the US still sees Pakistan as a special case, thanks to Afghan-istan and Kashmir. The former deputy secretary of state Richard Armitage has warned of "a large possibility" that jihadist groups will set off a war on the subcontinent. In turn, Pakistan's foreign minister, Khurshid Kasuri, blames the US for destabilising the region. "Until the west glorified jihad, inviting young men to come and fight the godless communists, Pakistan was a very peaceful country," he argues. "In the process, the border was radicalised, but once the Soviets were defeated, the Americans melted away. Afghanistan was a great theatre for jihad, in the same way that jihadists have found Iraq to be a great theatre."
The more unpopular Musharraf becomes, the less inclined he is to undertake reform or to implement the "true democracy" that he has promised. He speaks the language of a populist: devolving power, taxing the rich and arresting the corrupt. Yet corruption remains rampant, and far from regenerating democracy the khaki leadership has alienated the large majority from the political system. Violence and protest are now the people's only ways of venting their frustration.
Prime Minister Aziz claims that his government is neither "defensive nor apologetic" about its undemocratic nature. Musharraf's 1999 coup was "in the interest of Pakistan", he said, "and I think, with hindsight, it was the correct decision. We are not apologetic about our position. We think it suits our current set-up. We don't need any lectures in democracy but, step by step, we'll get there. It's not that we think democracy is bad."
Pakistan's generals have always been loyal to the army, rather than to such abstract ideas as democracy, Islam or even Pakistan. The country's 59-year history has been a series of duels between the generals and politicians. Judging by years in office, the generals are in the lead. Elected representatives have run the country for 15 years, and unaccountable bureaucrats or their proxies for 11, but the army has been in power for 33 years.
The fate of this military dictatorship is likely to depend on the support of the US. As long as Musharraf is able to play politics with Muslim discontent, however, while discredited former leaders such as Benazir Bhutto and Nawaz Sharif continue to divide the opposition, the necessary return to civilian rule will remain a prospect much more distant than a further descent into chaos.
Hugh Barnes is director of the democracy and conflict programme at the Foreign Policy Centre