After the joy of victory, the hard work begins for Nawaz Sharif

Election posters for Nawaz Sharif in Lahore
Image caption Nawaz Sharif fought a well organised and disciplined election campaign - but can he perform as well in government?

For most Pakistanis it has been a happy, busy and even triumphant weekend.

On Saturday morning they came out in droves to vote in the first election ever to afford them a chance to vote out a government, which we now know they did with a vengeance.

And many millions of them spent the night glued to their television sets that brought them progressive results - partial vote counts from polling stations across the country.

This brought many surprises.

One was a higher-than-usual voter turnout on a hot and humid day when it would have been all the more pleasurable to stay inside.

Upper class and upper-middle class people in the main urban centres - who seldom bother to vote - were to be seen standing in long queues for hours outside the polling stations.

Bigger surprise

Many said they had come out to vote for former cricketer Imran Khan, who promised a "new Pakistan" free of old faces, corruption and political ineptness.

Image caption Mr Sharif faces a series of tough decisions once in power

At a televised news conference early on Sunday morning Chief Election Commissioner Fakhruddin Ebrahim said that while official figures would take time to compile, he believed that nearly 60% of voters turned out on Saturday - the highest since Pakistan's first election in 1970.

And it was an even bigger surprise that awaited opposition leader Nawaz Sharif's PML-N party.

It was expected to win the most seats, but now it seems it will do better than that and even win a clear majority to allow it to form its own government instead of having to form a coalition. This was an outcome which no-one had predicted.

Technically, the PML-N is still short of a simple majority, but the margin is slim and likely to be filled in by candidates who won as independents.

Under the law, an individual winning as an independent candidate can join a political party and is recognised as a party member by the Election Commission as long as he or she does so before parliament goes into session.

Wiped out

For Imran Khan's Movement for Justice party (PTI), the surprise was a bitter-sweet one.

Image caption The new leader at least has a strong mandate to address Pakistan's many problems

It failed to sweep the country with a "political tsunami" that Mr Khan had threatened, but it did emerge as the largest party in the militancy-infected north-western province of Khyber Pakhtunkhwa (KP).

Yet, it is far short of a straight majority there, and will need the support of more than one group if it is to form a provincial government.

It also did fairly well in the country's most populous province, Punjab, where the results so far show it to be in third position after the PML-N and the independents.

Were there any surprises for the constituents of the former ruling coalition - the Pakistan People's Party (PPP) the Awami National Party (ANP) and the MQM?

The PPP is all but wiped out from Punjab, though it has largely retained it hold over its southern stronghold of Sindh province.

It is struggling in a neck-and-neck race with Mr Khan's PTI for second position in the national parliament.

The MQM also appears to have retained its position in its urban stronghold of Karachi.

But the ANP has been completely eliminated both from the national parliament and the provincial parliament of KP.

Historically these parties are likely to be credited for having scored a first by forming the first democratically-elected government to complete a five-year term - but they are also likely to be remembered for being in a government that never really shed its reputation for corruption and mismanagement.

No doubt Nawaz Sharif - now beginning his third stint as Pakistani prime minister - will be all too aware of these pitfalls when he takes over the reins of power.

His priorities will be rejuvenating the economy and improving security. These are both areas that require some speedy but difficult decision-making.

In the short run, he will need financial support to pay off previous loans Pakistan took from the IMF and also for the country's balance of payments needs.

These funds can only come from the IMF and the World Bank - institutions over which the United States has considerable influence.

The funds will be hard to get if Pakistan continues to be sluggish in eliminating militant sanctuaries on its soil.

As an opposition leader, Mr Sharif advocated negotiating with the militants instead of fighting them, and wanted an end to US drone strikes in Pakistani areas where they have sanctuaries.

He will now need to revisit his strategy if he wants his economic policies to succeed.

And for this he will not only have to evolve a wider consensus across the country's political divide, but also deal with the powerful military which may not be too keen on eliminating militancy quite yet.

He has had problems with the military in the past - he was toppled in a coup by Gen Pervez Musharraf - but many believe he may succeed this time if he can generate enough political support for his strategies.

And if these problems combined do not cause his in-tray to overflow, Pakistan's continuing energy crisis almost certainly will. Like the other problems it needs to be sorted out fast.

During the five-year term of the PPP-led government, millions of gas-driven vehicles ground to a halt because of a shortage of supplies while power outages rose to up to 12 hours a day across most of the country.

This hurt industrial production and led to lay-offs of industrial labour.

The new leader looks likely to have a shortened honeymoon.

Related Internet links

The BBC is not responsible for the content of external Internet sites