Pakistan election: Dozens killed on voting day
Pakistan has been hit by violence on the day of its general elections - with at least 31 dead in the worst attack.
A man blew himself up outside a polling station in Quetta, in an attack claimed by the Islamic State group.
Preliminary, unofficial results suggest ex-cricket star Imran Khan's PTI party is in the lead as votes are counted.
However, the rival party of disgraced former PM Nawaz Sharif, PML-N, has rejected the results amid allegations of vote rigging.
The campaign has been overshadowed by concerns of fraud and violence, and the Human Rights Commission of Pakistan says there have been "blatant" attempts to manipulate the polls.
There have also been delays in releasing the results. Baber Yaqoob, the secretary of the Electoral Commission, said this was due to technical errors, adding: "There's no conspiracy."
"The delay is being caused because the result transmission system has collapsed," Mr Yaqoob said.
According to unofficial initial results, the PTI party is currently leading in 109 national assembly seats, while PML-N is ahead in about 67 seats, local media report.
However, only votes from 34% of polling stations have so far been counted, Dawn newspaper says.
The turnout has been estimated at between 50% and 55% out of 106 million registered voters, AFP reports.
- Why Pakistan's election matters
- Fears of 'creeping coup' in Pakistan
- Who are the 'angels' and the 'electables'?
Several political groups have alleged that vote rigging is taking place in polling stations - something denied by election officials.
Representatives from several parties say 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.
Shehbaz Sharif, leader of the PML-N party and brother of ex-PM Nawaz Sharif, said the vote counting process was "unbearable and unacceptable" due to "manifest and massive irregularities".
"It's such a blatant rigging that everyone has started crying. Today what they have done has pushed Pakistan back 30 years," he said.
Mr Khan has vowed to tackle corruption but his rivals accuse him of benefiting from alleged meddling by the military, which has ruled Pakistan for nearly half of its history.
Mr Sharif, who won the last election, has been jailed for corruption after a scandal stemming from the Panama Papers leak.
How bad is the violence?
Despite tight security, with hundreds of thousands of troops and police officers deployed across the country, there have been violent attacks.
In addition to the suicide attack in Quetta, in Balochistan province, one person died in a grenade attack in Khuzdar, and another died in a shooting between political rivals in Swabi, Khyber Pakhtunkhwa province.
The Dawn newspaper also reported clashes in Mardan, Rajanpur, Khipro and Kohistan.
An IS-claimed attack targeting a political rally earlier this month in nearby Mastung killed at least 149 people.
Why is this election important?
Pakistan has been ruled on and off by the military during its 71-year history. This election is significant because it will mark only the second time that one civilian government has handed power to another after serving a full term.
But the run-up to the vote has been controversial.
Mr Sharif's PML-N complains of a targeted crackdown by the security establishment, with the alleged help of the courts, in favour of Imran Khan and his PTI party.
On Sunday, a judge in the High Court of Islamabad appeared to support that allegation, saying that the military Inter-Services Intelligence (ISI) organisation had been interfering in the judiciary.
In a BBC interview on Monday, Mr Sharif's daughter Maryam Nawaz - who was jailed earlier this month with her father on corruption-related charges - criticised the military.
"When a prime minister refuses to put down his head and do their [the military's] bidding, they pull him down with four things; get a religious fatwa issued against him, call him a traitor, call him a friend of India, or call him corrupt. They use these things against every elected prime minister," she said.
Several PML-N candidates also say they have been coerced to switch to the PTI. The Pakistani military denies interfering in politics.
Independent media, meanwhile, say there have been blatant attempts to muzzle them. There are also concerns about the participation of militants on international terror blacklists in the election process.
For all these reasons, the human rights commission has said there are "ample grounds" to question the legitimacy of the polls, "with alarming implications for Pakistan's transition to an effective democracy".
Has Imran Khan's time come?
By M Ilyas Khan, BBC News, Islamabad
As voters queued up outside polling stations, the question on everyone's mind was whether Mr Khan will be the next prime minister.
He entered politics in the late 1990s when memories of Pakistan's cricketers winning the World Cup were still fresh. But only in 2013 did his party emerge as a serious contender, with its leader touted as a harbinger of change, out to fight corruption.
He lost by a wide margin, but has continued to lead what many see as a divisive campaign.
In the constituency being contested by Mr Khan, a voter called Rauf told me he was voting for "anyone who uplifts the country". I asked who could do that, and he replied: "It's easy to guess. See what those who have been in power have done to the country. They've destroyed it."
Mr Khan has staked his campaign on shaking up the political order and taking on Pakistan's entrenched political dynasties.
This election is the closest he's ever got to being prime minister. Will that happen? Or will the PML-N stay the largest party after a sympathy wave by voters for the man he helped oust?
Who are the main candidates?
The election is generally seen as a contest between the PML-N and the PTI.
Nawaz Sharif - a 68-year-old three-time PM - made a dramatic return to Pakistan ahead of the vote to face a 10-year prison sentence. He was disqualified from office last year by the Supreme Court after the Panama Papers leak revealed his family's ownership of several luxury flats in London.
His appeal hearing will not be held until after the vote.
As he cast his vote in the Islamabad suburb of Bani Gala, Mr Khan, 65, told reporters it was "time to defeat parties which kept this country hostage for years".
- The cricket hero who could be Pakistan's next PM
- Nawaz Sharif: Pakistan's three-time PM
- Bilawal Bhutto Zardari: Heir to a political dynasty
The country's best-known opposition politician has denied colluding with the military. Analysts say he will have to make serious inroads in Punjab province - a PML-N stronghold - in order to win the vote.
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 Oxford University graduate.