Updated at 10.20am

Pakistanis began voting on Wednesday in a knife-edge general election pitting cricket hero Imran Khan against the party of jailed ex-Prime Minister Nawaz Sharif, with the prospect of neither winning a clear majority amid a looming currency crisis.

A suicide bomber killed at least 29 people near a polling centre as Pakistanis voted on Wednesday in a knife-edge general election pitting cricket hero Imran Khan against the party of jailed ex-Prime Minister Nawaz Sharif.

The Islamic State militant group claimed responsibility for the attack in the western city of Quetta, where security sources said the bomber drove his motorcycle into a police vehicle.

A hospital spokesman said 29 people were killed and 35 others wounded in the attack that a Reuters witness said occurred near a voting centre in Quetta, the capital of Baluchistan province.

Earlier this month, a suicide bomber killed 149 people at an election rally in the town of Mastung in Baluchistan province. That attack was also claimed by Islamic State militants.

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

A decade after Pakistan was last ruled by a military government, the election has been plagued 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. Khan has emerged as a slight favourite in national polls, but the divisive race is likely to come down to Punjab, the country's most populous province, where Sharif's party has clung to its lead in recent surveys.

"Let's test Imran as we have been testing others for the last several decades," said first-time voter Yousaf Ali, a 22-year-old medical student who cast his ballot for Khan's party in the city of Lahore in Punjab.

About 106 million peple are registered to vote in polls due to close at 6pm (1300 GMT). Results will start trickling in within hours, and the likely winner should be known by around 2am on Thursday.

Whichever party wins, it will face a mounting and urgent in-tray, from the 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.

"We are pitched against mafias," Khan, 65, said in one of his last rallies in the coastal city of Karachi. "These are mafias who made money in this country and siphoned it abroad, burying this nation in debt".

Khan has staunchly denied allegations by Sharif's Pakistan Muslim League-Nawaz (PML-N) party 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 of the 272 elected seats in the National Assembly, raising the prospect of weeks of haggling to form a messy coalition government.

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

"PUSHED AGAINST THE WALL"

Sharif's PML-N has sought to turn the vote into a referendum on Pakistan's democracy and campaigned to protect the "sanctity of the vote".

The Pakistan Peoples Party (PPP), which has been overtaken by Khan's PTI as the main challenger to PML-N but is widely seen as the likely kingmaker, has also alleged intimidation by spy agencies. Media houses and rights groups say the press has been muzzled and freedoms curtailed.

"We are being pushed against the wall," said Shehbaz Sharif, brother of former premier Nawaz and PML-N president. "I swear to God, we will break this wall and make this country prosper."

Sharif's PML-N has been touting its delivery of mega infrastructure projects, especially roads and power stations that helped hugely reduce electricity blackouts, as proof the country is on the path to prosperity.

PML-N's lacklustre campaign was reinvigorated by the return to Pakistan of party founder 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. He has denied any wrongdoing.

Although Nawaz Sharif is banned from political office for life, party officials say the PML-N base has been galvanised by his return to Pakistan to be arrested on July 13.

The three-time prime minister has called the legal cases against his family a politically motivated conspiracy by elements of the army and judicial establishment.

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

PTI leader Khan has in recent years shed his playboy image and adopted a more pious and conservative persona. He has vowed to create 10 million jobs if he comes to power and promised to build "world class" schools and hospitals.

"Imran Khan is the last hope for this country and its people," said Noorul Amin Sheikh, 43, who returned from the Middle East to vote in the city of Peshawar. "We have tested all the politicians and all of them proved corrupt and dishonest."

Khan has ruled out a coalition with PPP, saying he would not be able to implement change with corrupt "status quo" parties.

Without PPP, he would likely need support from independent candidates widely seen as a military proxy bloc, or candidates from small, ultra-religious parties, some of which have been linked with militant groups.

Cricket star-turned-politician Imran Khan.

Cricket star-turned-politician Imran Khan.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.