A supporter of Pakistani politician Imran Khan, chief of Pakistan Tehreek-e-Insaf party, releases fireworks to celebrate projected unofficial results. Photos / AP
Former cricket star Imran Khan looks set to become the next prime minister of Pakistan.
Official results declaring an outright winner were not expected before late this afternoon NZT.
However, early unofficial results gave Khan and his Pakistan Tehreek-e-Insaf (PTI) Party a commanding lead over his main rival, Shahbaz Sharif's Pakistan Muslim League.
Jubilant Khan supporters danced to the beat of drums at his party headquarters in Islamabad, sensing a victory. The sound of fire crackers echoed in the night sky.
After an election campaign overshadowed by violence and allegations of fraud, Pakistanis voted for a new government that will face challenges of a crumbling economy and ongoing bloodshed by militants whose latest attack saw a suicide bomber kill 31 people outside a polling station.
Sharif, the younger brother of disgraced Prime Minister Nawaz Sharif, who has been jailed on corruption charges, disputed the election results even before they were announced.
He charged fraud and vowed not to accept the results, generating fears that disgruntled losers could delay the formation of the next government.
The parliamentary balloting marked only the second time in Pakistan's 71-year history that one civilian government has handed power to another in the country of 200 million people.
There also have been widespread concerns during the election campaign about manipulation by the military, which has directly or indirectly ruled the country for most of its existence.
"We will sweep the elections," said Abdul Basit, a supporter of Khan's, who watched the results on a large TV screen.
Hours after the polls opened, a suicide bomber on a motorcycle detonated his explosives in a crowd waiting to vote in the southwestern city of Quetta. In addition to the 31 dead, the attack wounded 35 people, said Dr Jaffar Kakar, a hospital official. No one immediately claimed responsibility, but local officials were quick to blame Isis (Islamic State).
The attack in Quetta, the capital of Baluchistan province, underscored the difficulties the majority Muslim nation faces on its wobbly journey toward sustained democracy.
Baluchistan also saw the worst violence during campaigning earlier this month, when a suicide bomber struck at a political rally, killing 149 people, including the candidate Siraj Raisani. Another 400 were wounded. IS claimed responsibility for that attack. Baluchistan has seen relentless attacks, both by the province's secessionists and Sunni militants who have killed hundreds of Shias there.
The military deployed 350,000 troops at polling stations across the country.
Moeed Yusuf, associate vice-president of the Asia Centre at the Washington-based US Institute of Peace, said politically motivated mob violence is rare in Pakistan, while the attack in Baluchistan appeared to be the work of a terrorist group.
"Terrorist violence is a different issue altogether and is unlikely to affect political stability," Yusuf said. "Unfortunately, Pakistanis have gone through so much violence that they are desensitised to it."
Yusuf said the top challenge for the next government will be the economic crisis.
"The new government is going to be in an unenviable position, and especially Imran Khan, as he is not the preferred prime minister for Pakistan's two traditional chief patrons, China and the US."
Khan has been an outspoken critic of the US-led war in neighbouring Afghanistan as well as China's massive investment in Pakistan, which has racked up millions of dollars in debt to Beijing.
Khan's supporters showered his vehicle with rose petals as he arrived to vote near his home in the capital of Islamabad. Afterwards, he appealed to Pakistanis to vote in huge numbers "to save future generations."
As polls closed, Election Commission spokesman Nadeem Qasim told AP that the commission had told Khan that his vote could be disqualified because he cast his ballot in front of TV cameras, violating constitutional provisions on "the secrecy of the ballot paper." Video images showed a smiling Khan with his ballot in front of him as he marked it.
As early results gave Khan an edge, Maryam Aurangzeb of Sharif's Pakistan Muslim League raised the first allegations of ballot fraud and warned that his supporters might revolt if the charges prove correct.
"We will not allow anyone to steal the mandate the nation has given to us," she told a news conference. "So far, we are controlling our supporters, but we won't be able to convince them to exercise restraint if the results were manipulated against our party."
As voting ended, festive supporters of both parties gathered outside polling stations, dancing to the beat of drums.
The third-largest party is the left-leaning Pakistan People's Party, headed by Bilawal Bhutto, the son of late Prime Minister Benazir Bhutto, assassinated by the Pakistani Taliban, whom she had vowed to eradicate.
More than 11,000 candidates are vying for 270 seats in Pakistan's law-making National Assembly, the Lower House of Parliament, and 577 seats in four provincial assemblies. Under Pakistani law, separate seats are reserved for women and for non-Muslim minorities, which comprise 4 per cent of the population.
The 85,307 polling stations were open for 10 hours, an hour longer than in 2013. Voting for two parliamentary seats and six seats in provincial assemblies has been postponed due to attacks on candidates or disqualifications.
There are more than 105 million eligible voters — 59 million men and 46 million women.