By Zeeshan Haider
ISLAMABAD, Aug 18 (Reuters) - Pakistan's President Pervez Musharraf quit office on Monday to avoid impeachment charges, nearly nine years after the key U.S. ally in its campaign against terrorism took power in a coup.
Speculation the former army chief would resign had mounted since the fractious coalition government, led by the party of assassinated former prime minister Benazir Bhutto, said this month it planned to impeach him.
"Whether I win or lose, the nation will lose," Musharraf, 65, said of the impeachment process in an hour-long televised address in which he passionately defended his record.
"The honour and dignity of the country will be affected and in my view, the honour of the office of president will also be affected."
Prolonged jockeying and uncertainty over Musharraf's position had hurt financial markets in the nuclear-armed country of 165 million people, and raised concerns in Washington and elsewhere that it was distracting from efforts to tackle violent militants, especially in the areas bordering Afghanistan.
Coalition officials had said Musharraf sought immunity from prosecution but he said in his speech he was asking for nothing.
"I don't want anything from anybody. I have no interest. I leave my future in the hands of the nation and people," he said.
One main coalition party, that of former prime minister Nawaz Sharif whom Musharraf ousted in 1999, has insisted he face trial for treason. Bhutto's party says parliament should decide.
Musharraf ended his final address as president with the words: "May God protect Pakistan, may God protect you all. Long live Pakistan forever."
Pakistani stocks .KSE jumped 4 percent on the news and the rupee PKR=, which had lost a quarter of its value this year, began strengthening.
"It eliminates all the uncertainty in the market," saidAsad Iqbal, managing director at Ismail Iqbal Securities. "The government will hopefully start concentrating on the economy ... they have no excuses now."
Musharraf has been isolated since his allies lost parliamentary elections in February. But in his speech he defiantly lambasted the coalition for what he described as failed economic policies, and said he had brought prosperity.
The powerful army, which has ruled for more than half the country's 61-year history, has publicly kept out of the controversy over its old boss, and no protests over Musharraf's resignation were expected.
Indeed, celebrations broke out across the country after the announcement, with people dancing and handing out sweets.
"Thank God he's resigned. The country will do much better now," said Mohammad Ilyas, 30, in Karachi.
"VICTORY FOR BENAZIR"
The United States, apparently resigned to Musharraf's exit, had said Pakistan's leadership was a Pakistani issue.
After the announcement, President George W. Bush said he appreciated Musharraf's efforts to fight al Qaeda and other extremists, and was committed to a strong Pakistan that strengthened democracy and fought terrorism.
"President Bush looks forward to working with the government of Pakistan on the economic, political and security challenges they face," said White House spokesman Gordon Johndroe.
Old rival India reacted cautiously. Foreign Minister Pranab Mukherjee told reporters: "India will continue to have an amicable relation with Pakistan in the days to come".
Pakistan is committed to a peace process with India launched under Musharraf, but India fears a weak civilian government will not have his influence over the army and military spy agency, which India suspects has a hand in most attacks on its soil.
The chairman of the Senate, Mohammadmian Soomro, will be acting president until a new one is elected within 30 days, but it is not clear who that will be. Traditionally, Pakistan's president has been a figurehead, although under Musharraf the office was much more powerful.
Leaders of the ruling coalition, which had prepared impeachment charges against Musharraf focusing on alleged violations of the constitution, welcomed the resignation.
Bhutto's widower, Asif Ali Zaradri, who leads her party, said it was a momentous day for democracy and the people had been able "to roll back the frontiers of dictatorship".
He recollected one of his wife's sayings, that "democracy is the best revenge". Bhutto was assassinated in a Dec. 27 suicide attack the government blamed on an al Qaeda-linked militant.
Prime Minister Yousaf Raza Gilani, a senior member of Bhutto's party, also welcomed what he called the end of dictatorship but warned members of parliament they had the responsibility of proving the success of democracy.
A career army officer, Musharraf narrowly survived several al Qaeda-inspired assassination attempts.
Critics say he suffered from a "saviour complex" and believed he was indispensable. He promised to return Pakistan to democracy but opponents say he stifled political freedom.
As challenges mounted, Musharraf reverted to autocratic ways. His downfall will be traced back to March 9, 2007, when he tried to force Supreme Court Chief Justice Iftikhar Chaudhry to resign.