The news of the potential impeachment of President Pervez Musharraf means further political instability for Pakistan - at least in the short term.

Though a deal has finally been done between the Pakistan People's party (PPP), effectively led by the late Benazir Bhutto's husband, Asif Zardari, and Nawaz Sharif's Pakistan Muslim League-N (PML-N), this indicates a very temporary coincidence of interest rather than a new solidarity. However, the beleaguered president's decision not to go to China for the opening ceremony of the Olympic games shows he is taking the threat seriously.

No Pakistani president has ever been impeached and the procedure laid down in the 1973 constitution is likely to mean a classic drawn-out Pakistani politico-legal wrangle. Impeachment is a political process relying on a two-thirds majority of both houses of parliament deciding to remove the president from office on the grounds of gross misconduct, physical or mental impairment or violation of the constitution. Musharraf's declaration of a state of emergency last November, shortly after getting himself re-elected for a second five-year term, means the third option is the most likely.

But the PPP and the PML-N will need help from smaller groupings - including hardline religious elements and a significant number of the 17 independent parliamentarians - to get the impeachment through the national assembly. Such support is uncertain at best and all assembly members, particularly the independents, are likely to be the subject of frantic horse-trading.

Equally, Musharraf still has powerful and wealthy allies such as the loyalists of the Pakistan Muslim League-Q; and an impeachment could also prove to be unpopular at home and overseas.

The issues of the restoration of about 60 judges removed from their posts by Musharraf when he declared the emergency last year is directly linked to the impeachment. "They have to be restored otherwise the case that the president has acted unconstitutionally is not convincing," said Professor Osama Siddique, an expert in constitutional law in Pakistan.

A simpler way of ousting Musharraf may simply be to use the threat of the impeachment to force him to opt for a confidence vote. However, given that he is unlikely to win, the president will resist such a move if he can.

The west will be watching the evolving relations between the military and Pakistan's political leaders closely. A recent attempt to subject the country's powerful Inter Services Intelligence service (ISI) to civilian authority backfired badly. Even though Musharraf still has some friends within the sprawling military establishment, few analysts believe the army will intervene.

The real winner may eventually be Sharif, a two-time former prime minister who returned to Pakistan from exile in Saudi Arabia last year. His PML-N party did well in the spring elections, especially in the key province of the Punjab. He has the vote of much of the religiously conservative, patriotic commercial middle class in Pakistan's rapidly growing cities and has his finger on the popular pulse more than any other politician. And it is Sharif, who detests the president, who has pushed hard for impeachment.

Musharraf still has the theoretical constitutional right to dissolve parliament - subject to eventual supreme court approval. This is the political "smart bomb" that the president could use to delay his impeachment - but only at the cost of provoking a new election and giving Sharif, whom he ousted in 1999, the chance to consolidate his power. Whatever the result of this latest crisis, it is Sharif who is likely to come out on top.