Raucous celebrations broke out in the centre of Lahore in the early hours of Sunday as Nawaz Sharif appeared certain to secure victory in Pakistan's election and the former prime minister celebrated in front of crowds of his supporters.
Sharif expressed a desire to work with all parties to solve the country's problems in a victory speech given to his supporters as his lead in the national election became apparent based on vote counts announced by Pakistan state TV.
While it seemed likely Mr Sharif, who has twice served as the country's premier though without ever completing a term, would fall a little short of securing a simple majority, there appeared little doubt he had seen off the challenge of both the Pakistan Peoples Party (PPP), which recently completed a five year term in office, and that of a resurgent Imran Khan.
"I appeal to all to come sit with me at the table so that this nation can get rid of this curse of power cuts, inflation and unemployment," Sharif said, as his supporters clapped, cheered and danced in the streets.
Pakistan's election campaign has been marred by violence with the death toll leading up to Saturday's vote totalling well over 100. On Saturday itself, it was reported that up to 29 people were killed as a result of bomb blasts in Karachi and Peshawar, and gun attacks in Baluchistan.
The centre of Pakistan's electoral contest, which nationally saw a turnout of 60 per cent, was the province of Punjab, where Mr Sharif's party has been running the provincial government.
In Punjab, voting seemed to go reasonably smoothly and security was tight and some of the 600,000 security personnel spread out across the country, many of them heavily armed, were highly visible.
It was in the city of Lahore itself, Pakistan's second largest city, that the fight between Mr Khan's Movement for Justice and Mr Sharif's PML-N was at its fiercest, as the former sportsman tried to displace the former premier from his stronghold. Mr Sharif has long enjoyed solid support from the city's business and trading communities.
Earlier in the day, groups of young men had gathered near each other chanting slogans. “Bat!” one young man shouted in Mr Khan's constituency, referring to his appropriate election symbol. “Once more for the lion!” replied a group of Mr Sharif's supporters, referring to his symbol.
On Saturday morning, droves of enthusiastic first-time supporters of Mr Khan, principally from the urban middle classes, were prominent.
“I voted for Imran Khan, I voted for change, I voted for the country,” said Haider Ali, 28, a student. “We've seen them all, the other politicians. They shouldn't come back.”
At a polling station established in the Lahore College for Women University, located in a constituency which Mr Khan was himself was contesting, one family revealed their different preferences.
Samra Atif, 27, said she and her husband, a businessman, had voted for Mr Khan. However, her mother, Farhana Salman, had voted for Mr Sharif. She had also bullied her daughter into voting for Mr Sharif's party in the provincial assembly ballot.
“Mr Khan can confront corruption, God willing,” said the younger woman's husband, Atif Suleman. “We need change right now.”
The PPP looked set to do badly in Saturday's vote. There is widespread anger and frustration across the country as a result of electricity and energy shortages, the stumbling economy and pervasive corruption, and predictions suggested it could win as few as 33 seats.
While both the PPP and Mr Sharif have been praised for their different roles on the completion of a full term by an elected government - a first for the country - there is little affection for Mr Zardari and the party has suffered from not having high-profile candidates during the campaign. The son and political heir of assassinated former prime minister Benazir Bhutto, Bilawal Bhutto, has been noticeable by his absence.
The next government will have to contend with Taliban militancy, endemic corruption, chronic power cuts and crumbling infrastructure. One of the first likely tasks will be to negotiate with the International Monetary Fund for a multi-billion-dollar bailout.
If Mr Khan's PTI squeaks into second place ahead of the PPP, thanks to support from urban youths, who rallied behind his calls for an end to corruption and a halt to drone strikes, it would mark an end to decades of two-party dominance by the PML-N and PPP.
While supporters of Mr Khan will have been bitterly disappointed, observers said that a term as official leader of the opposition could serve both him and his party well for subsequent elections. The former cricketer remains in hospital following a fall while campaigning last week.