On Oct. 8 and again on Oct. 12, Pakistani border guards at a dusty checkpoint in the Khyber Pass waved on convoys headed into Afghanistan. Western intelligence officials said that under the trucks' tarpaulins were rifles, ammunition and rocket-propelled grenade launchers for Taliban fighters. Pakistan's premier spying agency, Inter-Services Intelligence, had long provided safe passage to armadas of truckers and smugglers who supplied a mountain of weapons to the Taliban war machine. But the policy was supposed to have changed in September after a Washington ultimatum to Pakistan.
A senior Pakistani intelligence official acknowledged that the Oct. 8 shipment did contain arms for the Taliban, but he said that it was the last officially sanctioned delivery and that the Pakistanis have since been living up to their commitment to the Americans.
Even around that time, there were signs of a change. Pakistani military advisers were withdrawn from Afghanistan over the following weeks, a move that Western intelligence officials say may have been a crucial factor in the surprisingly swift collapse of Taliban forces when confronted by the Northern Alliance.
"We did not fully understand the significance of Pakistan's role in propping up the Taliban until their guys withdrew and things went to hell fast for the Talibs," said a Western diplomat who has monitored the region for many years. Nonetheless, Inter-Services Intelligence, or I.S.I., remains what many describe as a state within a state, with independent, and worrying, political
"Power remains in the hands of a powerful group of `jihadi' generals who are outside the government apparatus, but have tentacles in government," the former prime minister, Benazir Bhutto, said in an interview. Ms. Bhutto is hardly an impartial observer. Now living in self - imposed exile in Dubai to avoid corruption charges at home, she blames I.S.I. for conspiring to topple her second government in 1996, in part because she refused to fully back the Taliban. But her view is shared by many in Pakistan's intelligence and diplomatic ranks, where the strong sense is that Gen. Pervez Musharraf, the president, must begin a broader purge if he hopes to loosen the grip of elements in I.S.I. who, even now, are loyal to the Taliban.
One of the agency's staunchly Islamist intelligence directors was Lt. Gen. Hamid Gul, who headed the agency in the late 1980's and remains an influential figure within it. "It will not be so easy for officers to set aside their beliefs and change sides," General Gul, who is retired, said in a recent interview.
General Gul remains a supporter of the Taliban and he denounced the Americans for condemning them and Osama bin Laden without providing any proof of guilt. "Osama bin Laden is a sensitive man and he had nothing to do with the attacks on America," he said. "You Americans will have to support the Taliban one day. They are not going to go away. They are integral, organic, historic." The agency and General Musharraf had specifically agreed to end support for the Taliban in a series of meetings and phone conversations right after Sept. 11.
But Pakistani intelligence officers and military advisers contined helping the Taliban at least into October, providing tactical advice and helping to strengthen fortifications around Kandahar, the southern stronghold of the Taliban, diplomats and intelligence officials said. To reverse this, on Oct. 7 - the day the Americans started bombing Afghanistan - General Musharraf took the strong - and risky - step of removing the director of I.S.I., Lt. Gen. Mahmood Ahmed, who is regarded as pro-Taliban. He replaced him with a moderate, Lt. Gen. Ehsan ul-Haq.
Speaking of General Musharraf, a senior American official said: "He knows he has got cells of Taliban people in intelligence and he's got a rule that he is going to kick anyone out who has been there four or five years because you don't know where the cells are."
To help the purge, American officials are questioning former Pakistani officials to compile a list of intelligence officers and other government officials whose pro-Islamic sentiments make them suspect, according to people who said they were interviewed as part of the search. For many within the intelligence service, helping the Taliban was as much a religious duty as a military one. Some of the officers had trained Afghan fighters against the Soviets when I.S.I. funneled $3 billion in American funds into Afghanistan.
For seven years, Pakistan's Islamic government had been the Taliban's main sponsor, alongside Mr. bin Laden. It provided military equipment, recruiting assistance, training and tactical advice that enabled the band of village mullahs and their adherents to take control of Afghanistan and turn it into a haven for terrorists.
The impact was considerable because, after fattening its coffers with American money, I.S.I. was able to tilt the battle in Afghanistan. Nasirullah Khan Babar, a retired army general who was Pakistan's interior minister in 1994, packed his country's diplomatic posts in Afghanistan with intelligence agents to ensure that the Taliban got the help they needed. "They were I.S.I. people who had been in the jihad and the Afghans had a lot of respect for them," General Babar said in a recent interview at his home in Peshawar.
One of those agents was Amir Sultan Tarar, who was designated consul general in Herat, in the west. He used the code name Colonel Imam, which adopts a religious title and was a common nom de guerre among I.S.I. officers. He befriended the Taliban's spiritual leader, Mullah Muhammad Omar, and provided tactical advice to his forces while also serving as a conduit for arms and money, according to former Pakistani intelligence officials. Like many of the Pakistanis, he donned a turban and grew a beard to blend in with his clients.
As the Taliban captured more territory and enforced their harsh brand of Islam on larger swaths of the population, concern began to grow in Pakistan and Washington. Even before the Taliban were formed, the United States was warning Pakistan about I.S.I.'s conduct in Afghanistan, saying that it risked being listed as a sponsor of terrorism and losing access to international financial assistance. That warning, which also referred to I.S.I. activity in Kashmir, a territory claimed by India and Pakistan, came in a letter from President George Bush in 1992, according to a former Pakistani official who saw it.
By early 1996, when Ms. Bhutto was serving her second term as prime minister, she became concerned about Pakistan's closeness to the Taliban and about I.S.I.'s control over Afghan policy, she said in the interview. A meeting of senior government officials was called to discuss pulling back from the Taliban. Gen. Jehangir Karamat, chief of the armed forces, argued that the agency should stop its activities inside Afghanistan and civilian members of the government argued that if Pakistan withdrew its support, the Taliban would melt away, according to a review of minutes from the meeting provided by a participant.
But Lt. Gen. Aziz Khan, deputy director general of I.S.I. at the time, offered an impassioned defense of the Taliban: "These people will make Pakistan strong. There is nothing we need to fear from them. All they will do if they take over Afghanistan is spread pure Islam." The intelligence service carried the day and Pakistan did not pull back. In the following months, the Taliban won impressive battlefield victories, taking Herat, Jalalabad and the capital of Kabul by the fall of 1996.
Military observers noticed a distinct change in tactics. The previously disorganized Taliban soldiers used 4-by-4 pickup trucks to outflank enemy forces and launch surprise counterattacks, employing artillery in more sophisticated ways.
American intelligence officers were certain that the Pakistanis were providing training and tactical advice to the Taliban along with money and weapons and this speculation was later supported by other evidence. Ms. Bhutto continued to object until she was ousted from office in November 1996. She blamed I.S.I. for toppling her, saying she had angered them by her refusal to recognize the Taliban as the official government of Afghanistan.
There were other plausible reasons, including allegations of corruption against her and her husband. Her military-backed replacement, Nawaz Sharif, extended the first diplomatic recognition to the Taliban in May 1997 and traveled to other Muslim countries in an attempt to persuade them to recognize the student militia. Only Saudi Arabia and the United Arab Emirates agreed.
With a freer hand under Mr. Sharif, the intelligence agency dispatched military advisers to a former Soviet base in Rishikor, southwest of Kabul, to set up a training camp for volunteers sent by Pakistani religious parties to fight in Afghanistan and Kashmir.
Some of the bloodiest battles of the civil war occurred in and around Mazar-i-Sharif in northern Afghanistan. After losing the city once and being rebuffed another time, the Taliban made a successful push in the fall of 1998 and drove out the Northern Alliance.
Western intelligence officials credit the victory to Pakistani military advisers who fought alongside the Taliban. An intercepted telephone conversation described by two Western diplomats seemed to back that assertion.
In the call, Colonel Imam, the I.S.I. officer from Herat, was heard to boast, "My boys and I are riding into Mazar-i-Sharif." By 1998, Mr. bin Laden was well established in Afghanistan after fleeing Sudan two years earlier. He and his network had set up terrorist training camps throughout the country, many of them alongside camps operated by the Taliban and I.S.I. While the Taliban and Mr. bin Laden clearly had a close relationship, Western diplomats and foreign intelligence officers said that the links between I.S.I. and the bin Laden network were more circumspect.
Conversations intercepted by American intelligence officials contained no references to direct links between Pakistani intelligence and the network of Arabs and other foreigners who came to learn their trade in Afghanistan, said a senior government official who reviewed many of the transcripts. After the bombings of two American embassies in East Africa in the summer of 1998 killed more than 250 people, the United States tried to find a way to pry Mr. bin Laden, who the Americans blamed for the attacks, out of Afghanistan.
In September 1999, government officials said, the director general of I.S.I., Lt. Gen. Ziauddin and Prime Minister Nawaz Sharif's brother, Shehbaz Sharif, were summoned to Washington. American officials told them Pakistan should force the Taliban to moderate their positions and turn over Mr. bin Laden. When the envoys returned, Pakistani officials said, the prime minister sent General Ziauddin to Kandahar to deliver the American message to Mullah Omar, who refused.
The next month, on Oct. 12, 1999, Mr. Sharif was overthrown in a military coup. At the time, Pakistan's top military commander, General Musharraf, was on his way back from Sri Lanka. His second in command was Lt. Gen. Aziz Khan, who had defended the Taliban while working for I.S.I. He made certain that power was handed over to General Musharraf when his plane landed in
Again, there were many reasons for the coup, but analysts said the agency and its loyalists felt Mr. Sharif had to go partly out of fear that he might buckle to American pressure and reverse Pakistan's policy toward the Taliban. One of the new military ruler's first acts was to cancel a top-secret mission being planned with the United States to send commandos using I.S.I.
Intelligence information into Afghanistan to capture Mr. bin Laden. Despite continuing pressure from the United States and sanctions against Afghanistan by the United Nations, General Musharraf held fast to his country's support of the Taliban until Sept. 11 changed the way much of the world viewed the Afghan militia and its guest, Mr. bin Laden. Even then, however, the entrenched elements within the intelligence agency who had backed the Afghans refused to switch sides without a fight, according to senior Pakistani officials aligned against the Taliban loyalists. That fight, they say, is still ongoing.