Pakistan voted on Wednesday in a historic general election that was as bitter, heated and bloody as expected following weeks of acrimonious campaigning.
Amid claims of vote rigging, election officials insisted there was "no conspiracy" although technical failures meant that the result would be delayed until late Thursday morning.
Earlier in the city of Quetta near the Afghanistan border, a suicide bomber drove a motorbike into a crowd of people near a polling station. Witnesses told The Independent the target appeared to be a police van, and there were at least five security officers among the 31 dead.
Both the frontrunners struck confident poses as voting drew to a close on a hot day where tensions often bubbled over between supporters of ex-cricket star Imran Khan and the Pakistan Muslim League (PML-N) of jailed former premier Nawaz Sharif.
Mr Khan's opposition PTI campaigned on a message of anti-corruption, while at the same time being accused of enjoying the status of the military's favoured candidate. He led in opinion polls going into the vote, and early unofficial results gave him a commanding lead.
More than 350,000 army personnel were deployed across the country to guard polling stations, both inside and out. Most voters The Independent spoke to seemed more grateful for the extra security than intimidated over their choice.
And in Baluchistan's capital Quetta, it was clear to see why such measures were needed. One witness, Abdul Haleem, was queueing up to cast his own ballot at a school-turned-polling station when he saw a motorcycle drive straight into a crowd of voters. Mr Haleem's uncle was killed in the blast that followed, he said.
"There was a deafening bang followed by a thick cloud of smoke and dust and so much crying from the wounded people."
Another witness, Majeed Akbar, said the motorbike seemed to be aiming for the large police presence outside the school. He saw "a cloud of smoke after the blast, it filled the sky and then after that a pool of blood, dead bodies and others injured".
There was a deafening bang followed by a thick cloud of smoke and dust and so much crying from the wounded people
Isis has claimed responsibility for the attack, as it did for the worst single atrocity during the campaign period - also in Baluchistan - when 149 people were killed in a bombing at a political rally.
Elsewhere in the country, scuffles between supporters of rival parties frequently turned violent. Two were killed in separate incidents in Sindh province involving gunfire or firecrackers, and there was a fully fledged gun battle between members of PTI and the secular ANP party in the northern city of Swabi, killing one person and wounding others.
There was anger at many polling stations even where there was no violence, with long queues forming outside many as an inefficient system creaked under the weight of 105 million registered voters. Most predicted turnout to be higher than in 2013, when PML-N won by a margin, but tens of thousands appear to have been turned away as polling booth staff took up to five minutes to process each person.
Despite striking a confident tone, PML-N spokesman Mushaid Hussain told reporters at a news conference that the party had formally applied for voting to be extended by one hour due to the delays "in almost all constituencies".
Another PML-N coordinator, Muhammad Mendi, said he believed officials were deliberately putting up "hurdles" to block voters adorned with the lion symbol of Mr Sharif's party.
PML-N was joined in its call by the third-polling Pakistan People's Party (PPP), led by Bilawal Bhutto Zardari, the son of former prime minister Benazir Bhutto. The election commission dismissed the request.
And as voting drew to a close, people were driving around Rawalpindi's roads, waving both PTI and PML-N flags and chanting slogans.
With only 20 minutes left, there was still a small line of women waiting to vote at a university near the Pindi Cricket Stadium.
"God willing, I will still manage to vote," Iqra, a 20-year-old student, said. This was the first time she was old enough to take part in a general election, and she admitted: "I haven't decided who to vote for yet; we'll see once I get inside." Nevertheless, she thought PTI would win.
Outside, Zubaida Begum, a long-time PML-N supporter in her seventies, was just leaving the polling station.
"I have been voting ever since there have been elections in Pakistan," she said.
She was adamant that Sharif would be vindicated after the elections and released from jail, where he has just started a 10-year sentence for financial irregularities relating to luxury properties in London, as revealed in the 2015 Panama Papers leak.
"Nawaz Sharif is a very good leader," Ms Begum said. "Allah will help him. There was absolutely no corruption."
Women's representation has been a major problem at this election, despite the best efforts of the authorities to introduce minimum requirements both for female candidates and female turnout in individual districts.
Just 171 of the more than 12,500 candidates were women, the electoral commission admitted on the eve of the vote, and there were reports from some parts of Khyber Pakhtunkhwa province of women being prevented from voting by traditional local councils.
In Lahore, eight activists from various parties were arrested on suspicion of preventing women voting, after a video circulated on social media showed a long, static queue of female voters outside a polling booth. Mandi Bahauddin, a city official, said the eight were under investigation and "would be charged in accordance with the law".
Pakistan general election: vote turns violent after suicide bombing
Mr Khan may have received the support of Pakistan's elite establishments, but observers have been concerned by how he has resorted to a crude populism to extend his appeal more broadly. The 65-year-old has courted the more extreme wings of Pakistan's religious spectrum by touting the death penalty for blasphemers and vowing to implement an "Islamic welfare state" if he comes to power.
Yasir Yusuf, a 33-year-old chef from the capital's small and downtrodden Christian minority, said he decided to vote for PTI despite concerns about Mr Khan's perceived tolerance for extremist Islamist parties.
"We are concerned, but when you are a minority you become meaner; we just think for ourselves," he told The Independent.
We are too little and this country is too big. I really want to vote for my country, not only for this small minority
"We are too little and this country is too big. I really want to vote for my country, not only for this small minority."
Asim Majeed, a 24-year-old MBA student, complained of "how slow the people are in there" as he emerged from casting his vote for PTI in Islamabad. He said he believed Mr Khan was different from other leaders.
"We have seen people like Nawaz Sharif," he said. "[Khan] is a new person so we can believe that he can bring some change in the country."