Former Pakistani leader Nawaz Sharif appealed for cross-party support to help rebuild the nuclear-armed but economically crippled nation after winning historic elections that defied Taleban violence.
Partial, unofficial results from Saturday's election represented a stunning comeback for the wealthy 63-year-old tycoon who was deposed as prime minister in a 1999 military coup and spent years in jail and exile.
But Sharif looked short of an outright majority, raising the prospect of coalition rule, as the party of former cricket star Imran Khan achieved its own breakthrough on an anti-corruption platform that resonated with younger voters.
Khan's party was set to take power as the provincial government in the restive northwest, where he has vowed to end US drone strikes. Sharif too has tapped into public anger about the missile attacks and pledged peace talks with the Taleban.
The landmark polls mark the first time that one elected civilian administration will hand power to another after a full term in office, in a country where there have been three coups and four military rulers.
Official results were emerging only slowly on Sunday but TV projections suggested no single party would win an absolute majority in the 342-seat national assembly.
Sharif's centre-right Pakistan Muslim League-N (PML-N) was well ahead with at least 115 of the chamber's 272 directly elected seats, according to various projections by private channels, and as many as 126 according to Geo TV.
Khan's Pakistan Tehreek-e-Insaf (PTI) was projected to win more than 30 seats, after a high-octane campaign that ended with the former cricketer immobile in hospital after falling at a rally.
The Bhutto clan's Pakistan People's Party (PPP), which led the outgoing coalition government, was trailing in third place as voters punished its record of ineffectual administration over the past five years.
Flanked by his brother and daughter, Sharif gave a victory speech late Saturday to hundreds of jubilant supporters at PML-N headquarters in Lahore.
"We should thank Allah that he has given PML-N another chance to serve you and Pakistan," he said, after nearly 60 per cent of the 86 million electorate turned out to vote despite polling day attacks by the Taleban that left 24 dead.
Sharif, who has vowed a pro-business agenda to revive Pakistan's feeble economy, struck a conciliatory tone following Khan's emergence as a new powerbroker in the country's clan-dominated politics.
"I appeal for all parties to come to the table and sit with me and solve the country's problems," Sharif said.
The election was fought over the tanking economy, an appalling energy crisis that causes power cuts of up to 20 hours a day, the unpopular alliance in the US-led "war on terror" and chronic corruption.
Prime minister twice before in the 1990s, Sharif's historic third term will begin only after he brokers a deal with rivals to form a coalition.
Political analysts said the PML-N would most likely have to team up with its former opponents from the outgoing PPP government.
"(Sharif) needs to solve the issue of terrorism and other problems crippling the economy. If he delivers quickly, fair enough, if not then he will face crisis and criticism," pundit Hasan Askari told AFP.
But Sharif's supporters hailed a new dawn for the nuclear-armed country. Youths in Lahore danced in the streets holding stuffed tigers - the PML-N's election symbol - and people offered sweets to celebrate the win.
Chief Election Commissioner Fakharuddin Ebrahim praised the authorities for cooperation "which enabled us to hold free and fair elections" and record the highest turnout figure since 1977.
But there were complaints of vote-rigging. Khan's PTI said it would meet later Sunday to look into allegations of ballot fraud including against the PML-N in Punjab, Pakistan's most populous province and Sharif's political heartland.
Besides the national assembly, voters also elected four provincial assemblies in Khyber Pakhtunkhwa, Punjab, Sindh and Baluchistan.
Khan's party emerged on top in Khyber Pakhtunkhwa, and PTI member Shaukat Yousafzai said "we will form our government here with the help of like-minded political parties".
Khyber Pakhtunkhwa is a hotbed of militancy. Both Sharif and Khan have vowed to negotiate with the Taleban but analysts say it is too early to say how this will affect the course of America's war on terror on the Pakistani-Afghan border.