ISLAMABAD, Pakistan — First and foremost, Pervez Musharraf considered himself a soldier, a onetime commando who believed he could shoot his way out of almost any fight.
Not this time. But the Pakistani president, who resigned Monday rather than face imminent impeachment proceedings, nonetheless displayed a flash of his former battlefield sensibilities, refusing to acknowledge the victory of his political enemies.
"Whether I win or lose, the nation will lose," he said of the prospect of an impeachment fight. Bidding farewell to an honor guard a short time later, he was as stiff-backed in a business suit as he once had been in uniform.
In Wasif Khan's cramped grocery store in Islamabad, the perspiring crowd gathered around the little television set behind the counter erupted in wild cheers when it heard Musharraf utter the word "resignation."
Two taxi drivers hugged each other, then ran outside to their cabs to sound their horns in celebration. The rejoicing spread rapidly, with Pakistanis firing guns in the air, throwing flowers and handing out sweets. Some danced for joy.
For eight years, Musharraf enjoyed near-absolute power in Pakistan, holding the post of president as well as military leader. Under international and domestic pressure, he relinquished his post as army chief of staff in November to become a civilian president.
But even then, he clung to the military milieu. When he celebrated his 65th birthday last week, the guests were his old comrades-in-arms, without so much as a nod to the new civilian power structure.
His authority significantly curtailed after his party's landslide loss in February, Musharraf continued to live in the army chief of staff's designated quarters and maintained offices at military headquarters in Rawalpindi, the garrison city adjacent to the capital, Islamabad.
Retreating into a figurehead role in the new civilian government, he kept a careful public silence about the country's new leaders. But he privately expressed his contempt for what he saw as the disorganized ways of the ruling coalition.
In 1999, when Prime Minister Nawaz Sharif sought to force him from his post as army chief, Musharraf staged a bloodless coup and packed Sharif off into exile.
Days after the Sept. 11, 2001, attacks, when the Bush administration told him in no uncertain terms to choose sides in the battle against the Taliban, Musharraf signed on as a key U.S. ally.
Both of those actions came back to haunt him. Sharif, now a dominant force in the new civilian government, has been unrelenting in his drive to dislodge Musharraf and still wants him put on trial for treason. And domestic anger built over what was perceived in Pakistan as a fratricidal war against Islamic militants, even as the Bush administration began turning a jaundiced eye on the general who had been touted as a loyal ally.
Through it all, Musharraf retained a certain aloofness of demeanor. Assassination attempts against him, including narrow escapes weeks apart at the end of 2003 and the beginning of 2004, helped fuel a sense of invincibility, some associates said.
As a commander, he was accustomed to being obeyed. So he was astonished and infuriated when the country's activist chief justice, Iftikhar Chaudhry, defied him when Musharraf tried to push the jurist aside in the spring of 2007. That authoritarian display helped propel his political foes to an overwhelming election victory Feb. 18, and many analysts considered Musharraf to be on borrowed time ever since.