After seizing power nine years ago, the once-popular leader initially supported Afghanistan's Taliban, only to turn his back on them to support the US after Sept. 11, 2001. He survived several assassination attempts and watched his support plunge as he stalled on democratic reforms and suspended independent-minded judges.
Pakistan's divided government must now pick a successor while also tackling a growing threat from militants and a sputtering economy.
But the mood Monday was one of exhilaration, with many cheering the president's long-sought exit. Across the country, Pakistanis rejoiced on the streets.
"This is a historically great day for Pakistan and a triumph for democracy," says Samina Ahmed, South Asia project director of the International Crisis Group. "It is the first time a dictator has been forced to step down by a democratically elected government."
Musharraf – who, since February, has been sidelined in a democratically elected government – addressed the nation in a long and often emotional televised address. He held his announcement until the end.
"This is not time for individual bravado. I lose or win in impeachment proceedings; the Pakistani nation will be the loser," said the somber-looking former Army chief. "After taking advice from my supporters and friends, I have decided to resign in the best interests of the nation."
Pakistanis have been waiting for this news since Aug. 8, when the leaders of its government – former Prime Minister Nawaz Sharif of the PML-N Party and Asif Ali Zardari of the Pakistan People's Party (PPP) – announced they were seeking to impeach Musharraf for imposing a state of emergency last November and other alleged crimes.
The suspense has built in recent days amid myriad rumors of an imminent resignation and his determination to fight impeachment. Some even speculated that Musharraf would use his presidential powers to dissolve parliament.
It was unclear Monday whether the government would seek to press further charges against him or, indeed, whether it would provide him with the security that the former Army chief will require to remain in Pakistan. Musharraf has been the target of at least four assassination attempts during his time in power.
Many had regarded the US as an obvious destination once Musharraf had fallen from power. But on Sunday, US Secretary of State Condoleezza Rice said that granting asylum to Musharraf was not "on the table."
"My own guess is that was diplomatic language, meaning his options are much more limited," says Ms. Ahmed.
The Bush administration has distanced itself from Pakistan amid Musharraf's political decline and concerns that he wasn't doing enough to prevent the northwest region bordering Afghanistan from becoming a stronghold for Al Qaeda and the Taliban.
It is a long and humiliating fall for the man who came to power nine years ago on a tide of popular support.
Nine years in power
When Musharraf – a sporty and respected soldier who won gallantry medals during Pakistan's 1965 war against India – ousted then-Prime Minister Sharif in a bloodless coup in 1999, opinion polls showed 70 percent of the public was behind him.
Pakistanis had become disenchanted with the allegedly corrupt civilian rule of Sharif, whom Musharraf put on trial for corruption and sent into exile. It was Sharif who pushed hardest in recent days for Musharraf's exit.
Musharraf became the fourth military ruler of Pakistan, which has been governed by the Army for more than half its 60-year existence.
The US soon conscripted this religious moderate as a key ally in its fight against terrorism. His government was the biggest recipient of US aid in Asia after Afghanistan.
He also did much to build bridges between India and Pakistan, initiating a cease-fire across the border in 2003 and pushing for peace talks, especially over the disputed region of Kashmir.
But the tide began to turn against Musharraf last year. A violent Army siege against the radical Red Mosque in Islamabad, in which 105 people were killed triggered a surge in Islamic militancy in Pakistan. Today, many Pakistanis attribute the country's militancy problem to Musharraf's close alliance with the US.
Last November, Musharraf ousted dozens of judges and imposed a state of emergency when the Supreme Court met to rule on the legality of his reelection as president while still Army chief.
When the PPP, PML-N, and other parties won parliamentary elections in February, speculation arose as to whether Musharraf would eventually be forced out.
A fractured government moves on
Having effected Musharraf's departure, Pakistan's government faces a slew of difficult tasks. The economy is growing at its slowest rate since 2003 and the government's peace treaties with militants in the northwest have crumbled into frequent, deadly clashes.
The government must also decide whether to reinstate the more than 60 judges whom Musharraf suspended – a move Mr. Zardari has wavered on, but which Sharif supports.
"His going will allow the transition to democracy," says Ahsan Iqbal, education minister and a senior spokesman of Sharif's PML-N Party. "It will bring internal harmony and restore stability to the country."
There are concerns, however, that the government is not up to the task, having proved itself inefficient and fractured during its few months of rule. When Sharif and Zardari announced they were seeking to impeach Musharraf, it was a rare moment of unity between the former bitter allies.
Though the PPP is currently Pakistan's biggest party, many here expect Sharif's PML-N to take that spot because of the support it will probably receive from members of Musharraf's PML-Q Party. Musharraf formed the PML-Q out of the PML-N when he ousted Sharif in 1999.
The government will now be tested by the election of a new president, a process that must be undertaken by an electoral college taken from the lower and upper houses within a month.
There have been reports Zardari will push for a president from the PPP; Sharif is known to oppose this idea.
But first, the government plans to strip the president's powers by altering the Constitution. This will require two-thirds support in both houses of parliament, raising the prospect of another long squabble over how to reform the presidency – and who then should take the job.