By Chris Morris
BBC News, Islamabad
Mr Musharraf is now striking a conciliatory tone
He'd railed against the opinion polls. He'd accused the media of bias. But there's not much President Musharraf can do about the voice of the people.
Pakistan's voters have inflicted a heavy defeat on him and his supporters in parliament. It could even threaten his political survival.
Why? Because Pakistanis have voted fairly clearly for change. The next government will have to be a coalition, but it will have a strong democratic mandate.
And it will have to decide how it chooses to work with a president who's never had much time for politicians with broad popular support.
The two main opposition parties - the Pakistan People's Party (PPP) and the Pakistan Muslim League (Nawaz) (PML-N) - will have a dominant presence in the next parliament. Together they could form a stable coalition, but political bargaining is only just beginning.
There's no doubt that the PML(N) - led by former Prime Minister Nawaz Sharif - is gunning for President Musharraf. It has made that very clear throughout this election campaign.
"Musharraf said he would quit when people tell him, and people have now given their verdict," said Mr Sharif in his first public statement after the results emerged.
He called upon opposition parties to unite "to rid the country of dictatorship".
But the PPP has been less explicit. Its co-chairman Asif Ali Zardari has been careful to keep his options open.
The party is still convinced that vote-rigging cost it many seats in this election, but it hasn't yet ruled out working with anyone, including the president.
Many would be glad to see the back of the president
"Our whole attempt here is to be in government so we can change the system," said Sherry Rehman, the central information secretary of the PPP.
"And you have to slowly and transitionally change the system from within."
And what about President Musharraf himself? What is his best strategy for dealing with the opposition?
It could be divide and conquer. But in what felt like an appeal to the opposition to give him another chance, he too has appealed for reconciliation.
"We need a stable and democratic political environment in this country," he said in an election night appearance on state-run TV. "That's why I've called this the mother of all elections."
"All the political parties and leaders should realise that in Pakistan they should not have a confrontational approach."
But the president is no longer arguing from a position of strength. This election has shown how far his popularity has fallen during the political turmoil of the past year.
Now the man who has enjoyed the support of western countries for the best part of a decade looks weaker than ever. Many analysts believe his days are numbered.
But if any lasting benefit is to emerge from this election, all Pakistan's politicians will have to prove that they have learnt from the mistakes of the past.
"The country has suffered enormously," said Tariq Fatemi, a former ambassador and political analyst. "The kind of polarisation that you see in Pakistan today is unprecedented."
Mr Zardari's party is playing its cards carefully
"In two of the four provinces there is virtual state of insurgency. There is alienation, anger and outrage. Unless the two sides rise to the occasion, the country could be facing very choppy waters."
So big questions remain.
Will a new government try to free senior judges who are still under house arrest and will it begin to heal domestic political wounds?
Will it be able to focus on the challenge from pro-Taleban militancy which has threatened the stability of this country and spread concern around the world?
In the short term, much depends on the approach of the PPP, which looks set to be the biggest party in parliament.
But it is still reeling from the assassination of Benazir Bhutto in December. There is no-one of her stature left in the current party leadership.
Whatever government eventually emerges from the horse-trading, it will face tremendous challenges.
Rising instability, highlighted by a spate of suicide bombings and the Islamist insurgency near the Afghan border, has meant plenty of international attention has been focussed on this election.
Now, many people will now be looking to the victors to give the country a fresh start.