ISLAMABAD, Pakistan - A commando at heart, and a man of often impetuous decisions, Pervez Musharraf ended Pakistan's support of the Taliban leadership in Afghanistan after 9/11 and pledged to help the United States, becoming one of Washington's most crucial allies in the campaign against terrorism.
It was a bold stroke that boosted the Bush administration in its immediate war against Al Qaeda, and allowed the United States to work with Pakistani intelligence to arrest senior Qaeda operatives inside Pakistan. Mr. Musharraf also gave Washington permission to strike at Qaeda targets in his nation's lawless tribal areas.
But the assurances turned out to be less than promised, and though Mr. Musharraf forged a personal bond with President Bush, the Pakistani general proved to be a tough, frustrating customer for the United States.
Pakistan's powerful Inter-Services Intelligence agency never severed ties with the Taliban.
Nine years later, the Taliban are putting up a ferocious fight against the United States in Afghanistan, and are providing shelter to Al Qaeda in the tribal areas. The rejuvenated Taliban now virtually control Pakistan's tribal region bordering Afghanistan, and are pressing into the rest of the country, threatening the stability of the nuclear-armed nation of 165 million people.
"Musharraf continued to provide cover to the Taliban, but still managed to convince the Americans for many years that it was not a double game," said Ahmed Rashid, a Pakistani expert on the Taliban and the author of "Descent into Chaos," a book that details the relationship between Mr. Musharraf and Washington. "It was a remarkable feat of balancing on the tightrope."
The feat was so skilful that Mr. Musharraf won more than $10 billion in American military assistance for his army, as well as unannounced covert aid. About half the military aid was supposed to be spent on bolstering the counter-insurgency skills of the Pakistani army.
Much of that money never reached the military and was allocated instead to Pakistan's general budget, but the Bush administration was so anxious to keep Mr. Musharraf as an ally it chose not to complain, according to a congressional investigation this year.
Washington finally lost patience last month. In a diplomatic showdown, the Pentagon and the Central Intelligence Agency confronted the new prime minister, Yousaf Raza Gilani, with evidence that the Pakistani intelligence service helped plan the July 7 terror attack against the Indian Embassy in Afghanistan's capital, Kabul.
But by that time, Mr. Musharraf's power was eclipsed, and the Bush administration acknowledged that Mr. Musharraf's usefulness was past.
Mr. Musharraf stepped down as chief of the army last November, handing the post to Gen. Ashfaq Parvez Kayani , who has kept above the fray in the effort to impeach the president.
After grabbing power from Prime Minister Nawaz Sharif in October 1999, Mr. Musharraf began his tenure as president with a wave of support from a public weary of a decade of weak and corrupt civilian government.
In the beginning, he attracted competent people to his cabinet, and promised to tackle longstanding problems, including the spread of madrassas, the religious schools that had become breeding grounds of Islamic extremists.
But the madrassas remained untouched, mainly because Mr. Musharraf handed the task to the Ministry of Religious Affairs which was opposed to the plan, according to Jehangir Tareen, a former minister of industries and special projects in the Musharraf cabinet.
Mr. Musharraf backed some important reforms in the news media and the rights of women, according to his supporters and his critics. Now, dozens of private television stations exist, many of them with rambunctious political talk shows. He also moved to improve the status of women by pushing for the amendment of strict Islamic laws.
"Musharraf tried to construct a modern enlightened state," said Mr. Tareen. "But he proved you cannot do this on the structure of a patronage-riven and police-oriented political machine."
One of his greatest shortcomings, Mr. Tareen said, was his disdain of democratic methods, and civilian politicians.
In 2002, Mr. Musharraf ordered a referendum to be held, a yes or no vote on his legitimacy as president. No opposition candidates were permitted to stand and rallies by opposition political parties were banned.
After parliamentary elections six months later, Mr. Musharraf engineered political support from the Chaudhry clan, a powerful group of politicians in Punjab Province who were seen as anti-reformist. They created a political party, the Pakistan Muslim League-Q, as a vehicle for Mr. Musharraf. When conservative religious parties swept those parliamentary elections in the North-West Frontier Province, Mr. Musharraf sought their support too.
In March 2007, facing elections in a few months time, Mr. Musharraf fired the chief justice, Iftikhar Muhammad Chaudhry , apparently out of fear that the judiciary might undermine his re-election.
A tidal wave of support for Mr. Chaudhry from lawyers across the country turned into a vibrant anti-Musharraf campaign.
In November, Mr. Musharraf declared a state of emergency and fired 60 judges. By the time he lifted the decree in December, he was seen as an unpopular dictator, and by then, his main political opponents, Benazir Bhutto and Nawaz Sharif, had returned to Pakistan to run in elections.
Ms. Bhutto was assassinated at the end of December, postponing elections that were scheduled for the beginning of January. But Ms. Bhutto's widower, Asif Ali Zardari, picked up the reins of the Pakistan Peoples Party, and in February elections, the two parties swept into power. They formed an uneasy coalition that left Mr. Musharraf's political party flailing for support.
In the end, his failure to manage his double game of keeping the Americans on his side and keep allowing the religious extremists to thrive may have proved his undoing, and left Pakistan in a more precarious position, Mr. Rashid said.
Last year, there were 56 suicide attacks in Pakistan, many of them carried out by the Taliban ensconced in the tribal areas. The Taliban were pouring out of the tribal areas into more settled regions, striking anxiety into an army unaccustomed to fighting an insurgency.
"The Taliban are not only an external problem for Pakistan, they have now become an internal problem for Pakistan," said Mr. Rashid.
Copyright 2008 The New York Times Company