President Pervez Musharraf has resigned as head of the army shortly before being sworn in for another term as president, this time as a civilian.
The BBC's M Ilyas Khan in Karachi looks at the prospects for President Musharraf, Benazir Bhutto and Nawaz Sharif, the three biggest names in Pakistani politics as they vie for power.
The retirement of Pervez Musharraf from the army is widely seen as the most significant development in Pakistan since the coup of 1999 which brought him to power.
But the transition has been not as smooth as he would have liked.
He had to impose emergency rule and sack more than half the judges of the higher judiciary to ensure that the Supreme Court would endorse his re-election as president.
This controversy will haunt him as he prepares to share power with a popularly elected prime minister and an army chief with his own view of the world.
Although President Musharraf will retain powers to dismiss the elected government, his ability to do so will hinge on how popular the prime minister is and whether the army is willing to back such a drastic step.
In the past, the army's support has been crucial for presidential action against elected governments. But in recent years it has lost much credibility as a fighting force and has attracted widespread criticism for dabbling in politics.
Many analysts believe the main concern of the new army chief will be to restore the army's image and streamline its combat efficiency.
However, President Musharraf will be counting on the military leadership's shared wish to deny the politicians full powers under an 'unbridled democracy'.
In the short term, his chief concern will be the electoral performance of the PML-Q party, which has provided him with what is widely seen as a 'rubber-stamp parliament'.
But even a PML-Q victory in January's elections is unlikely to produce a prime minister who will not at some point begin to see President Musharraf as a rival laced with 'undemocratic' powers.
Also any attempt by the government to manipulate the elections might, as one analyst put it, "prove to be his Waterloo".
Former Prime Minister Benazir Bhutto is gearing up to step into the same system that worked to her disadvantage in the 1990s.
Having been elected prime minister twice, she was sacked by successive presidents using their powers to dismiss the government with the tacit support of the army.
But critics and admirers alike think she is a wiser person now - someone whose extensive networking in the US administration and the Pakistani establishment enabled her to end her exile without too much trouble.
She has been quick to challenge President Musharraf's chief political ally, the PML-Q, in its power-base in Punjab province, which holds more than 50% of the country's voters.
A senior Pakistani analyst, Irshad Ahmed Haqqani, credits her with having canvassed the US administration for the return of Nawaz Sharif, another exiled former prime minister.
Ms Bhutto has overwhelming support in Sindh province, and widespread support in Punjab. She will be hoping for a three-way contest in Punjab as this would split the votes of her rivals, the pro-Musharraf PML-Q and the PML-N of Nawaz Sharif.
If she succeeded in splitting her rivals, her Pakistan People's Party could win a clear majority in the parliament, setting her up as the next prime minister.
She may also enter into a selective seat-to-seat adjustment with Mr Sharif in Punjab to minimise the PML-Q's chances of winning seats.
But a possible election boycott by Mr Sharif and any manipulation of the elections by the administration could result in a hung parliament. That would be the best possible scenario from President Musharraf's viewpoint.
Another two-time prime minister, Nawaz Sharif, looks to have less chance of regaining the post than Ms Bhutto or even a PML-Q nominee.
But if he campaigns for his party, he could have a major impact in Punjab and could even be instrumental in wiping out the PML-Q.
His candidature remains doubtful, partly because of a court conviction in 2000, for which he was sentenced to life in jail. The sentence was waived by the Musharraf government, which sent him into exile the same year.
This may be the reason why Mr Sharif has attached tough pre-conditions to his participation in the election. One such condition is the reinstatement of all the judges sacked when emergency rule was introduced on 3 November.
The chances of the judges regaining their jobs look non-existent as their dismissals were key to President Musharraf getting his new term as president endorsed by more compliant judges.
Mr Sharif has also said that he will never agree to be prime minister in a government in which Pervez Musharraf is the president.
So Mr Sharif's best bet may well be to boycott elections with a view to undermining their credibility. For this to succeed, he needs Ms Bhutto to join the boycott.
Alternatively, he might enter into an electoral arrangement with Ms Bhutto to defeat the PML-Q, a party that was put together by introduced Musharraf's intelligence chiefs from the remnants of Mr Sharif's PML-N.
This strategy would be likely to spark defections from the PML-Q back to the PML-N, thereby helping him to regain the party he lost to President Musharraf eight years ago.
One legal problem facing both Ms Bhutto and Mr Sharif is that President Musharraf has steered through a constitutional amendment banning anyone from being prime minister for three terms.