Pervez Musharraf is considering stepping down as president of Pakistan rather than waiting to be forced out by his victorious opponents, aides have told The Sunday Telegraph.
One close confidante said that the president believed he had run out of options after three of the main parties who triumphed in last week's poll announced they would form a coalition government together, and also pledged to reinstate the country's chief justice and 60 other judges sacked by Mr Musharraf in November.
"He has already started discussing the exit strategy for himself," a close friend said. "I think it is now just a matter of days and not months because he would like to make a graceful exit on a high."
According to senior aides, Mr Musharraf wants to avoid a power struggle with the newly elected parliament, in which his opponents will be close to the two-thirds majority needed to impeach him and remove him from office.
"He may have made many mistakes, but he genuinely tried to build the country and he doesn't want to destroy it just for the sake of his personal office," said an official close to the president.
Mr Musharraf, who stepped down as head of the army late last year, had called for a harmonious coalition after the defeat of his party - which won just 38 out of 272 national assembly seats in last Sunday's elections - but his political rivals have demanded he go.
Officials said he had considered resigning immediately after the election results were known, but had been persuaded by party loyalists that his sudden departure could precipitate a crisis.
In an article published last week he insisted that he would serve out his five-year presidential term.
Behind the scenes, his staff attempted to broker an agreement with Asif Zardari, who became leader of the main Pakistan People's Party (PPP) following the assassination of his wife, Benazir Bhutto.
Yet despite pressure from America, which has relied on Mr Musharraf's support for its war on terror, Mr Zardari refused to strike a deal.
He declined despite also claiming to have been threatened by Mr Musharraf's allies that the government would revive long-standing corruption charges against him.
"I have seen these jails and this is not something new to me," said Mr Zardari. "I fought all these fake cases instituted against me with courage and never disappointed anyone by asking for a pardon.
"I'm ready to fight it out again, and will never disappoint anyone."
PPP officials said that any deal with Mr Musharraf would have dented the party's public support and it was better to try to govern with the help of the other main parties.
"It doesn't make any sense for us to sink with the dying man," said Nisar Khuhro, a senior PPP leader, referring to Mr Musharraf.
Jamil Soomro, a PPP spokesman, said: "He has betrayed everyone since the very outset and we have no guarantee that he would not betray us once he stabilised his position."
Mr Musharraf's popular support drained away over the past year as he interfered with the independence of the courts, imposed a state of emergency, restricted the media and postponed elections.
Shortages of basic foodstuffs and unreliable gas and electricity supplies have left him more vulnerable now than at any time since he seized power in a bloodless coup in October 1999.
A coalition of the anti-Musharraf parties - the PPP, PML(N) and ANP - would govern with 211 MPs, just short of the 228 needed for the two thirds majority that would allow them to launch impeachment proceedings against the president. They could, however, win support from other smaller parties and independent members, which would leave the former general in a precarious position.
If Mr Musharraf decides to dig his heels in, the opposition parties plan to remove his constitutional powers to dissolve the assembly.
"I think his game is over but if he was able to survive for any reason, he would be like a dead fish, sitting and rotting the presidency," said Khwaja Asif, a senior leader of the Pakistan Muslim League.
The frontrunner to take over as prime minister in the new administration is Makhdoom Amin Fahim, the widely respected vice-president of the PPP.