Media playback is unsupported on your device Media caption Five things to know about Imran Khan

Early results from Pakistan's election suggest ex-cricket star Imran Khan is on course to become prime minister.

With nearly half the votes counted from Wednesday's parliamentary election, Mr Khan's PTI party is in the lead.

It is expected to fall short of an overall majority and to seek coalition partners. Officials deny claims of vote rigging made by Mr Khan's rivals.

Campaigning has been marred by violence. On voting day a bomb killed 31 people at a polling station.

Mr Khan, the charismatic captain who led Pakistan to a World Cup victory in 1992, has long shed his celebrity playboy image and has recently faced accusations that his election challenge is benefiting from military interference in the nuclear-armed republic.

With votes counted in 49% of stations, Mr Khan's Pakistan Tehreek-i-Insaf (PTI) party was leading in 119 of the 272 National Assembly constituencies being contested, Pakistan's Dawn Newspaper reported, citing election commission figures.

A total of 137 seats is required for a majority.

Image copyright EPA Image caption Newspapers featuring Mr Khan read "victory" and "man of the match"

This election will mark only the second time that a civilian government has handed power to another after serving a full term in Pakistan.

But the party of disgraced former Prime Minister Nawaz Sharif has rejected the results, as have a host of smaller parties, all alleging vote-rigging and manipulation.

"The way the people's mandate has blatantly been insulted, it is intolerable," Shehbaz Sharif, leader of the Pakistan Muslim League-Nawaz (PML-N) and brother of the former prime minister.

Mr Khan, who first entered politics in 1996 but struggled for years on the political sidelines, now styles himself as a pious, populist, anti-poverty reformer.

The 65-year-old campaigned on a message of anti-corruption and vowed to take on Pakistan's entrenched political dynasties. But his views on Islamist militancy will be scrutinised if he becomes prime minister - he has criticised some of the Taliban's violence but last year his party's government in Khyber Pakhtunkhwa province gave $3m (£2.3m) to the notorious Haqqania madrassa, headed by a man known as the "father of the Taliban".

On Thursday, Dawn said the Human Rights Commission of Pakistan (HRCP) had raised questions over the voting process. "The commission received complaints that in many areas women were not allowed to vote," the newspaper reported.

The party of assassinated former Prime Minister Benazir Bhutto, the historically liberal PPP, is widely expected to come third.

It is now fronted by Ms Bhutto's son, Bilawal Bhutto Zardari, a 29-year-old who became party chairman when he was still a student at Oxford University.

The turnout has been estimated at between 50% and 55% out of 106 million registered voters, AFP reports.

What will be the next prime minister's main challenges?

Before the election Mr Khan told the BBC that if he were to be elected, his initial focus would be on the economy. Pakistan's currency, the rupee, has declined by 20%. Inflation is on the rise and the trade deficit widening.

Exports such as textiles have taken a hit from cheaper products by regional competitors, including China. Analysts say the new government may need to turn to the International Monetary Fund (IMF) for the country's second bailout since 2013.

The BBC's Secunder Kermani in Islamabad says tough decisions that could entail curbs on spending will be easier in a government Mr Khan is able to dominate.

However, if his rivals continue to reject the results, and even potentially launch the kind of street protests Mr Khan did while in opposition, the country could face political instability.

Why does this election matter?

Pakistan has a population of nearly 200 million, and is a nuclear-armed rival to India, a key developing economy and one of the world's largest Muslim-majority nations.

The country has been ruled on and off by the military during its 71-year history, so this election is significant because it is considered the country's second consecutive democratic transition.

The election has been seen as a contest between Mr Khan's PTI party and Mr Sharif's PML-N.

Mr Sharif, who won the last election, has been jailed for corruption after a scandal stemming from the Panama Papers leak.

Are the elections clean?

Both the run-up to the vote, and the vote count itself, have been highly controversial.

Ahead of the elections, the PML-N complained of a targeted crackdown by the security establishment, with the alleged help of the courts, in favour of the PTI party. The Pakistani military denied interfering in politics.

Independent media, meanwhile, say there have been blatant attempts to muzzle them, while the human rights commission has said there are "ample grounds" to question the legitimacy of the polls.

After the polls closed on Wednesday, several political groups alleged that vote rigging was taking place in polling stations - something denied by election officials.

Representatives from several parties said that their polling agents were expelled from polling stations during vote count and were denied certified copies of results - breaching election procedures.

Analysts have also highlighted unusual delays in the announcement of unofficial results in dozens of constituencies, especially in the crucial province of Punjab which has been a stronghold of PML-N.

Election officials say delays in releasing the results are simply down to failures in the electronic reporting system and that votes are now being counted manually.

Image copyright EPA Image caption Wednesday's attack in Quetta has been claimed by the Islamic State group

Who is Imran Khan?

Previously an international cricket star who led Pakistan to a World Cup victory in 1992

Educated at the University of Oxford

Attracted media attention for his playboy lifestyle and three marriages

Launched his Pakistan Tehreek-e-Insaf (PTI) in 1996 but spent years on the political sidelines

Has campaigned against corruption and dynastic politics in Pakistan

Faces accusations - which he denies - that his party is benefiting from alleged meddling by the military

Read more: The cricket hero who could be Pakistan's next PM

More on Pakistan's election