Men stand in line to cast their vote during the general election in Peshawar

Pakistan has voted in a historic general election, after a bitter and violent campaign left the country highly polarised.

Voters were deciding between the former cricket legend and playboy Imran Khan, and the party of ex-leader Nawaz Sharif, who has been jailed on corruption charges that he says are politically motivated.

Fears of violence in the build-up to polling day have proved founded, as Isis claimed responsibility for a suicide bombing that left 32 dead in Quetta. But in many parts of the country, people have travelled to vote regardless of the security issues.

Please allow a moment for the live blog to load

Mr Khan's PTI party has positioned itself as an anti-corruption vehicle of change - but Mr Sharif's PML-N has accused him of being the military's candidate. With the race expected to be tight, independents and other smaller parties - like the PPP led by the son of former prime minister Benazir Bhutto - could yet play a key role in coalition.

Wednesday's vote was to be the first time Pakistan has ever achieved a second democratic transition of power in a row. Throughout its history, the country has oscillated between military and civilian rule.

Yet while that should be being hailed as an unprecedented landmark of stability for the nation, there have long been warning signs in a campaign that has been one of the most dangerous and distasteful in modern history.

From social media to the streets, the vicious nature of the campaign polarised Pakistani society into supporters of Mr Khan’s Pakistan Tehreek Insaf (PTI) party, and the incumbent Pakistan Muslim League – Nawaz (PML-N) of Mr Sharif.

The chief election commissioner (CEC), retired Justice Sardar Muhammad Raza, on Tuesday assured voters that the Election Commission of Pakistan (ECP) was “trying its best to hold free, fair and unbiased elections”.

In a video message released by the election body, Mr Raza urged voters to fulfil their “duty towards the nation” by casting their votes calmly and responsibly on polling day.