Former cricketer Imran Khan has claimed victory in Pakistan's election, amid accusations of vote rigging by rivals.

In a television address, he said: "We were successful and we were given a mandate."

His PTI party is still expected to fall short of an overall majority, so it would have to seek coalition partners in order to form a government.

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

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

An official confirmation of the vote is still to come.

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 election has been seen as a contest between Mr Khan's PTI party and Mr Sharif's PML-N, with the party of assassinated former Prime Minister Benazir Bhutto, the historically liberal PPP, widely expected to come third.

In his address, Mr Khan said: "I think this has been the clearest, fairest election Pakistan has ever had." He added that he would investigate any claims to the contrary.

He also appealed to his rivals to join hands with him to develop Pakistan. And he vowed to hold talks with India to seek a resolution to the dispute over the Kashmir region, a key flashpoint between the nuclear-armed countries.

He also called for "mutually beneficial" ties with the United States, despite being an outspoken critic of that country's anti-terrorism measures in the region, such as drone strikes.

What are the latest figures?
Figures from the Electoral Commission show Mr Khan's Pakistan Tehreek-i-Insaf (PTI) party has 105 of the 272 National Assembly constituencies being contested.

Earlier, unofficial projections from Pakistan's Dawn Newspaper reported the PTI on 120.

A total of 137 seats is required for a majority.

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

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

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.

Who are the other main players?
Mr Sharif, who won the last election, is in jail after a scandal stemming from the Panama Papers leak, but remained a looming figure in this election.

He appointed his brother, Shahbaz Sharif, as head of the PML-N, to run in his absence.

Bilawal Bhutto Zardari, a 29-year-old son of former Prime Minister Benazir Bhutto, ran for the PPP, after becoming party chairman when he was still a student at Oxford University in the UK.

Who is Imran Khan?
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.

"God has given me a chance to come to power to implement that ideology, which I started 22 years ago," he said in his speech.

He also said he would not live in the prime minister's usual grand residence. "Whatever the ruling elite has been doing in Pakistan so far with the taxpayers' money, I'm promising you today I will change all of that."

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".

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.

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.