ISLAMABAD, Pakistan — Often impetuous and a commando at heart, President Pervez Musharraf pledged to reverse Pakistan’s longstanding support of the Taliban after 9/11, bending to tremendous American pressure to become one of Washington’s most crucial allies in the campaign against terrorists.
But he largely failed to live up to that commitment, to the increasing frustration of American officials, who invested $12 billion in assistance to Pakistan.
Though Mr. Musharraf forged a personal bond with President Bush that assured American support for him even as his public standing declined precipitously, he produced only mixed results for Washington, increasing suspicions that he was playing a double game.
His pledge to fight terrorism aided the Bush administration in its immediate war against Al Qaeda and the Taliban in Afghanistan, making Pakistan an essential supply pipeline for NATO and American troops.
Later, Mr. Musharraf allowed the United States to work with Pakistani intelligence to arrest senior Qaeda operatives inside Pakistan, and he discreetly gave Washington a green light to strike at Qaeda targets in Pakistan’s lawless tribal areas.
Yet for every decision that Mr. Musharraf calculated would help the United States, there were many that did not, leaving policy makers in Washington to wonder which side he was really on.
Today, the Taliban and Al Qaeda, according to the United States intelligence assessments, are more entrenched in Pakistan’s tribal areas than they were several years ago, and are exacting an increasing toll on American and NATO forces across the border in Afghanistan.
Mr. Musharraf, though a secular leader who is said to enjoy the occasional tumbler of Scotch, did little to undercut the power of extremist clerics in the nation, or to curb the Taliban and other militant groups, which had long been used by Pakistan’s intelligence services to exert influence in India and Afghanistan.
Yet he also displayed a taste for military adventurism and sometimes reckless pursuit of Pakistan’s own goals, which were sometimes at odds with American interests.
When he was chief of army staff, he brought Pakistan to the brink of nuclear war with India by deploying troops to a remote part of the Himalayas called Kargil. President Clinton negotiated a cease-fire in 1999, a move that Mr. Musharraf later complained was forced on Pakistan and that amounted, he said, to an unconditional withdrawal.
And he presided over the worst cases of nuclear proliferation in history. A national hero, Abdul Qadeer Khan, who had masterminded the building of his country’s atomic bomb, was allowed to transform himself into the largest and most sophisticated exporter of bomb-making designs and equipment. Dr. Khan’s illicit network sent designs and nuclear material to Iran, North Korea and Libya.
On the central post-9/11 issue for the United States, the curbing of the power of the Taliban and Al Qaeda, Pakistan’s powerful Inter-Services Intelligence agency never severed ties with the Islamic extremists.
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.”
As a result, General Musharraf won billions of dollars in American military aid, as well as covert aid. About half the military aid was supposed to be spent on bolstering the counterinsurgency 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 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 country’s new prime minister, Yousaf Raza Gilani, with evidence that the Pakistani intelligence service helped plan the July 7 terrorist attack against the Indian Embassy in Kabul, Afghanistan.
By then, however, Mr. Musharraf’s power was eclipsed, and the Bush administration acknowledged that Mr. Musharraf’s usefulness was past.
His popularity among Pakistanis plummeted in the last year. In June, 85 percent of the people wanted him to resign, according to a poll by the International Republican Institute, a nonprofit organization based in Washington. Two years before, a poll by the institute found that the president had an approval rating of 60 percent.
One of the reasons for the collapse of his reputation was a failing economy, battered by capital flight, rapidly falling foreign-exchange reserves and soaring inflation, now at 21 percent. People struggle to pay for flour and fuel.
The entire country suffers from prolonged power failures, which, according to the International Monetary Fund, can be attributed largely to the failure of the Musharraf government to build power plants. One of Pakistan’s few growth industries is the sale of generators for domestic and industrial use.
General 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. He promised to tackle the spread of madrasas, the religious schools that had become breeding grounds of Islamic extremists.
But the madrasas remained untouched, mainly because he handed the task to the Ministry of Religious Affairs, which was opposed to the plan, according to Javangir Tareen, a former minister in the Musharraf cabinet.
The president backed some important changes involving the media and the rights of women. Now, dozens of private television stations exist in Pakistan, 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, including those dealing with rape.
“Musharraf tried to construct a modern enlightened state,” Mr. Tareen said. “But he proved you cannot do this on the structure of a patronage-driven and police-oriented political machine.”
One of the president’s greatest shortcomings, Mr. Tareen said, was his disdain for democratic norms and civilian politicians.
In 2002, General Musharraf ordered a referendum on his legitimacy as president. No opposition candidates were permitted to run, and rallies by opposition political parties were banned.
In March 2007, facing elections later in the year, 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 Justice Chaudhry from lawyers across the country turned into a vibrant anti-Musharraf campaign.
By November, the general felt trapped, declared a state of emergency and fired 60 judges. He relinquished his position as head of the army last November, but by the time he lifted the state of emergency in December, he was seen as an unpopular dictator, and his political opponents, Benazir Bhutto and Nawaz Sharif, had returned to Pakistan to contest elections.
After Ms. Bhutto was assassinated, her husband, Asif Ali Zardari, took the reins of the Pakistan People’s Party. In February elections, the two opposition parties swept into power, forming an uneasy coalition.
In the end, Mr. Musharraf was unable to strike a balance between the Americans and the religious extremists, and Pakistan is left in a more precarious position as a result, Mr. Rashid, the writer, said.
Last year, there were 56 suicide attacks in Pakistan, many of them in urban areas, that were attributed to the Taliban ensconced in the distant tribal areas. The Taliban are now pouring into more settled regions, arousing great anxiety in a demoralized army often loath to fight an insurgency, and posing a serious threat to Pakistan itself.