The country faces days of political horse-trading after a strong performance by independent candidates loyal to jailed former prime minister Imran Khan scuppered the chances of the army-backed Pakistan Muslim League-Nawaz (PML-N) from winning a ruling majority.
Khan's Pakistan Tehreek-e-Insaf (PTI) defied a months-long crackdown that crippled campaigning and forced candidates to run as independents with a combined showing that still challenged their rivals.
The military looms large over Pakistan's political landscape, with generals having run the country for nearly half its history since partition from India in 1947.
"Elections are not a zero-sum competition of winning and losing but an exercise to determine the mandate of the people," army chief General Syed Asim Munir said in a statement released by the military.
"As the people of Pakistan have reposed their combined trust in the Constitution of Pakistan, it is now incumbent upon all political parties to reciprocate the same with political maturity and unity.
"The nation needs stable hands and a healing touch to move on from the politics of anarchy and polarisation which does not suit a progressive country of 250 million people."
- Forced to cut deals -
After long delays in results that prompted further allegations that the military establishment had engaged in vote-rigging, PML-N declared victory Friday as the party with the largest number of seats.
However, to form a government, the party founded by three-time former prime minister Nawaz Sharif will be forced to cut deals with rivals and independents.
There were reports late Friday of leaders from several parties arriving in PML-N's power base of Lahore for talks.
"We don't have enough of a majority to run the government ourselves, therefore we invite the other parties and candidates who have been successful to work with us," Sharif said at his party headquarters in the city.
In an AI-generated video produced by PTI, Khan was credited as claiming victory for the party.
"According to independent sources, we were winning 150 national assembly seats before the rigging started," said the message posted on his X account, which featured a genuine video clip of him from a year ago and an AI-generated voice-over.
A slow counting process showed independents had won at least 100 seats -- 89 of them loyal to Khan -- by Saturday morning.
PML-N took 71 and the Pakistan Peoples Party (PPP) snapped up 54, with 13 of the elected 266-seat National Assembly still to be announced.
Minor parties shared 27 seats between them -- including the Muttahida Qaumi Movement (MQM), which took 17 -- which are likely to be of great interest to PTI in the coming days.
If PTI's independents join one of them, they can take a share of the further 70 unelected seats reserved for women and religious minorities, which are allocated according to party performance in the contested vote.
- 'Recount our votes' -
Most of the seats won by Khan loyalists were in Khyber Pakhtunkhwa, where police said at least two PTI supporters were killed Friday and more than 20 wounded when they protested against alleged vote-rigging in Shangla district -- the first serious post-election violence reported.
"Our results have been changed," claimed 28-year-old shopkeeper Muhammad Saleem, who joined around 2,000 PTI supporters marching in Peshawar.
"The government should recount all of our votes."
Khan was barred from contesting the election after being handed several lengthy prison sentences in the days leading up to the vote.
A nationwide election day mobile telephone blackout and the slow counting of results led to suspicions the military establishment was influencing the process to ensure Sharif's success.
"PTI as a party and political group, despite significant efforts by the civilian and military establishment, has held on to its vote bank," said Bilal Gilani, executive director of polling group Gallup Pakistan.
"It shows that the military does not always get their way -- that is the silver lining," he told AFP.
The PPP, whose popularity is largely limited to its Sindh heartland, also did better than expected.
The PML-N and PPP joined forces with minor parties to boot Khan from office in April 2022 after his PTI won a slender majority in the 2018 election.
The former international cricketer then waged an unprecedented campaign of defiance against the military-led establishment, which originally backed his rise to power.
Khan was convicted last week of treason, graft and having an un-Islamic marriage in three separate trials -- among nearly 200 cases brought against him since being ousted.
Britain said it noted "serious concerns" about the election, while the United States said that "claims of interference or fraud should be fully investigated".
The Free and Fair Election Network gave the election commission a generally positive report card for how it conducted the vote, but said the delay in announcing results "overshadowed an otherwise orderly election", raising questions about the outcome.
Short link: