MASTUNG, Pakistan — Hundreds of voters were packed shoulder to shoulder at an election rally less than two weeks ago in a mud-walled village in western Pakistan, listening to the candidates speak, when a white flash ripped across the gathering, followed by a horrible boom.
A suicide bomber had struck the rally in Mastung, Pakistan, in one of the most catastrophic election-related attacks in recent years — 151 were dead, and 177 wounded.
Then on Sunday, in northwestern Pakistan, a suicide bomber blew himself up near a candidate’s car, killing Ikramullah Gandapur, a member of the Pakistan Justice Movement, the party headed by Imran Khan, the former cricket star and contender for prime minister. Mr. Gandapur’s driver was also killed, and three others were wounded, including two police officers.
The Pakistani Taliban claimed responsibility for Sunday’s attack, a spokesman for the militant group said.
On July 10, Haroon Bilour, a candidate from a political party opposed to the Taliban, was assassinated in a suicide bombing as he campaigned in northwestern Pakistan, in an attack that killed at least 12.
With these election-related attacks rattling the country, Pakistanis worry about what will happen on Wednesday, when tens of millions of people go to the polls to vote in a closely contested national election that several militant groups are violently opposing.
“Security agencies have failed to provide us security,” said Lashkari Raisani, whose brother, Siraj Raisani, a popular candidate, died in the attack in Mastung. “We are paying with our blood.”
For years, Pakistan has been plagued by militant groups, including the Islamic State and the Taliban. The Islamic State claimed responsibility for the attack in Mastung, although the Pakistani authorities deny that the group is operating inside the country.
In the run up to the election, militant groups have attacked competing political sides, killing both people who support Pakistan’s domineering military and also those opposing it.
Pakistani officials said they were deploying nearly 400,000 security officers on Wednesday, and increasing their presence at airports, railway stations, bus terminals, markets, hospitals and schools.
Tensions have been rising in the country since Nawaz Sharif, a former prime minister, and his daughter, were jailed this month on corruption charges. Mr. Sharif claims that the security establishment has tried to undermine his political party, the Pakistan Muslim League-Nawaz, so that Mr. Khan, a rival politician, can win.
Many people at the July 13 rally in Mastung, a poor, rural part of Balochistan Province, had come to get national identification cards so they could vote for the first time.
“I was overjoyed when someone told us we can get our cards for free,” said Nazar Muhammad, a nomad who attended the rally and who cannot move his right leg after an injury suffered in the attack.
A majority of Baloch tribesmen living in remote rural areas do not have national identity cards, which are necessary to cast a vote in general elections. Resourceful politicians promised them identity cards in return for votes.
Siraj Ahmed lost two brothers and several cousins in the attack. He said he was motivated to vote “for the betterment of our tribe.”
“Never,” he added, “did we think elections would be so bloody.”
Shah Meer Baloch reported from Mastung, and Jeffrey Gettleman from Abu Dhabi, United Arab Emirates. Salman Masood contributed reporting from Islamabad, Pakistan.