Pakistani politician Imran Khan, chief of Pakistan Tehreek-e-Insaf party, arrives to cast his vote at a polling station for the parliamentary elections in Islamabad, Pakistan. Picture: AP Photo/Anjum Naveed

Islamabad - Pakistan was locked in a close and tense election race on Wednesday, pitting cricket hero Imran Khan against the party of jailed ex-Prime Minister Nawaz Sharif in a process marred by a suicide bomb that killed 31 people near a polling station.

Khan's camp was increasingly confident as early projections showed him in the lead, while Sharif's party and several others complained of rigging in the vote count.

Neither Khan nor Sharif's party appeared likely to win a clear majority in the National Assembly, with results likely to be known by around 2 a.m. local time on Thursday (2100 GMT Wednesday).

Early projections from four local TV channels all put Khan's party ahead, estimating it would win between 94 and 102 of 272 elected seats available, while Sharif's outgoing ruling party was estimated at between 40 and 58. However, those projections were based on only about 10-15 percent of votes counted.

A spokeswoman for Sharif's party, the Pakistan Muslim League-Nawaz (PML-N), said there were already "serious reservations" about the vote count after reports soldiers stationed in polling stations had thrown out political parties' monitors during the tabulations.

About 371 000 soldiers have been stationed at polling stations across the country, nearly five times the number deployed at the last election in 2013.

Khan's party spokesman, Fawad Chaudhry, showed confidence as the early projections were broadcast, saying in a tweet "Congratulations to the nation on a new Pakistan! Prime Minister Imran Khan."

The election will be only the second civilian transfer of power in Pakistan's 71-year history.

But campaigning has been plagued for months by allegations the powerful armed forces have been trying to tilt the race in Khan's favour after falling out with the outgoing ruling party of Sharif, who was jailed on corruption charges this month.

"SHAMELESS RIGGING"

Wednesday's voting was marred by a suicide bombing that killed 31 people near a polling station in Quetta, capital of the southwestern province of Baluchistan. Islamic State claimed responsibility.

During the count, outgoing PML-N Defence Minister Khurram Dastgir-Khan tweeted that official result forms were not given at hundreds of polling stations, decrying what he called "blatant, callous, shameless rigging".

The third major party, the Pakistan Peoples Party, also complained that its polling agents were asked to leave during the vote count in a number of voting centres.

"This is the warning bell of a serious threat," said PPP senator Sherry Rehman. "This whole election could be null and void, and we don't want this."

Several smaller parties made similar complaints in public statements.

Whichever party wins, it will face a mounting and urgent in-tray, from a brewing economic crisis to worsening relations with on-off ally the United States to deepening cross-country water shortages.

An anti-corruption crusader, Khan has promised an "Islamic welfare state" and cast his populist campaign as a battle to topple a predatory political elite hindering development in the impoverished mostly-Muslim nation of 208 million people, where the illiteracy rate hovers above 40 percent.

"This is the most important election in Pakistan's history," Khan, 65, said after casting his vote in the capital, Islamabad.

"I ask everyone today - be a citizen, cherish this country, worry about this country, use your vote."

PROSPECT OF WEEKS OF HAGGLING

Khan has staunchly denied allegations by PML-N that he is getting help from the military, which has ruled Pakistan for about half of its history and still sets key security and foreign policy in the nuclear-armed nation. The army has also dismissed allegations of meddling in the election.

Khan's Pakistan Tehreek-e-Insaf (PTI) party has inched ahead of PML-N in recent national polls, but even if it gets the most votes, it will likely struggle to win a majority, raising the prospect of weeks of haggling to form a messy coalition government.

Such a delay could further imperil Pakistan's economy, with a looming currency crisis expected to force the new government to turn to the IMF for Pakistan's second bailout since 2013. PTI has not ruled out seeking succour from China, Islamabad's closest ally.

The PML-N has sought to turn the vote into a referendum on democracy, and has said it was campaigning to protect the "sanctity of the vote", a reference to a history of political interference by the military.

The PPP, which has been overtaken by Khan's PTI as the main challenger to PML-N, has also alleged intimidation by spy agencies.

PML-N spokeswoman Maryam Aurangzeb also said there had been complaints about the vote counting.

"We have serious reservations. Our political agents have been pushed out and results are being withheld," she told a press conference.

PML-N's campaign had been reinvigorated by the return to Pakistan of Nawaz Sharif, 68, who was earlier this month convicted and sentenced in absentia to 10 years in prison over the purchase of upscale London apartments using offshore companies in the mid-1990s.

Sharif has denied any wrongdoing and accused elements of the judiciary and military of conspiring to bring down his government.