Pakistan's beleagured president Pervez Musharraf today finally fell on his sword and announced that he was standing down as the country's head of state.
After days of mounting speculation, Mr Musharraf delivered a televised speech to the nation in which he said he was resigning to avoid an impeachment battle that would harm the nation's interests.
Wearing a suit and tie and sitting in front of a photograph of Pakistan's founder Muhammad Ali Jinnah, Mr Musharraf launched a staunch defence of his eight-and-a-half years in office, a period that began when he seized power in a coup in 1999. He said he helped move the country towards democracy, had overseen steady economic growth and had strengthened the position of women. He said his enemies had leveled unfair charges against him.
Mr Musharraf, a long-time ally of the US, had seen his popularity sink since May 2007 when he sacked the country's Chief Justice Iftikhar Chaudhry. The move resulted in widespread demonstrations of support for the judge who had dared stand up to the military leader.
"After consultations with legal advisers and close political supporters and on their advice, I'm taking the decision of resigning," said Mr Musharraf in his address. "My resignation will go to the speaker of the National Assembly today."
Two weeks ago the coalition government, led by the Pakistan People's Party (PPP) of assassinated former prime minister Benazir Bhutto, said it planned to impeach Mr Musharraf. The powerful army, which has ruled for more than half the country's 61-year history, publicly kept out of the controversy over its old boss.
The charges detailed in the impeachment papers were to include allegations that Mr Musharraf had violated the constitution. Mr Musharraf, 65, said he rejected the allegations but felt the country would suffer it he had to confront the charges
In recent days it became clear that Mr Musharraf's allies were negotiating a behind-the-scenes deal to aid his exit from office. They had been insisting that he receive full immunity from prosecution and he afforded appropriate security. It remains unclear whether the details of the deal have been fully agreed but it was clear that the PPP - if not its coalition ally, former Prime Minister Nawaz Sharif - was keen to give Mr Musharraf time to resign. Those involved in the negotiations involved officials from Saudi Arabia, as well as the United States and Britain.
The lengthy jockeying and uncertainty over Mr Musharraf's position had hurt Pakistan's financial markets and raised concern in Washington and among other allies it was distracting from efforts to tackle militants. Today, Pakistan's markets soared on the news that the president had resigned.
Mr Musharaff's resignation had been anticipated for some time. Since parliamentary elections in February in which he political opponents secured an overwhelming victory, his position had become increasingly fraught. Indeed, in the aftermath of the election it was questioned whether he could survive until the summer.
The all-important issue for Pakistan now is what happens next. The rivalry between the Mr Sharif and the PPP's leader, Asif Ali Zardari, is well known and it remains to be seen how the two parties will continue to work together. Both men have said they are not interested in becoming Pakistan's President. It is widely assumed, however, that both men will fight for the much more powerful position of Prime Minster.
Following is some detail of what happens when a president steps down:
* According to the constitution, the chairman of the Senate, the upper house of parliament, Mohammadmian Soomro, will become acting president.
* A new president will be elected within 30 days, for a five-year term.
* A president is elected by an electoral college made up of members of both houses of parliament and the four provincial assemblies.
* Traditionally in Pakistan, the president has been a figurehead with the prime minister holding most powers although under Musharraf the president was much more powerful.
* Musharraf retained the authority to dismiss parliament and make top military and judicial appointments but the coalition partners have vowed to strip the presidency of those powers and make it a ceremonial post.