Southwestern Pakistan witnessed the blast days ahead of the general elections (AFP)

A suicide blast ripped through a crowd at a political rally in southwest Pakistan Friday killing 128 people and wounding 150, officials told AFP, in one of the deadliest attacks in the country's history.

The blast in the town of Mastung, near the Balochistan provincial capital Quetta, was the latest in a string of attacks that have spurred fears of violence ahead of nationwide polls on July 25, and underscored the fragility of Pakistan's dramatic gains in security.

Authorities said the suicide bomber detonated in the middle of a compound where the political meeting was taking place.

"Human remains and red bloody pieces of flesh were littered everywhere in the compound. Injured people were crying in pain and fear," said local journalist Attah Ullah.

One political worker, Salam Baloch, said he heard a "deafening blast" and saw a "thick grey ball of fire and smoke".

"People put... bodies and the injured in rickshaws and other vehicles and rushed them to hospital before rescue officials arrived," he added.

Emergency workers also shuttled victims in ambulances as bystanders sobbed in the darkness due to the lack of electricity in the impoverished area.

Survivors in blood-smeared clothes were taken to hospitals in Mastung and nearby Quetta, where they were greeted by tense crowds of mourners, an AFP reporter said. The deceased could be seen covered in shrouds.

"The death toll has risen to 128," Balochistan home minister Agha Umar Bungalzai told AFP. A senior provincial government official also confirmed the figure, adding that 150 others were injured.

Among the dead was Siraj Raisani, who was running for a provincial seat with the newly-formed local Balochistan Awami Party (BAP), Bungalzai said.

The attack was the most lethal since Taliban terrorists assaulted a school in the northwestern city of Peshawar in 2014, killing over 150 people, mostly children, and one of the deadliest in Pakistan's long struggle with terrorism.

It came hours after four people were killed and 39 injured when a bomb hidden inside a motorcycle detonated close to another politician's convoy in Bannu on Friday, near the border with Afghanistan.

The politician -- Akram Khan Durrani, a candidate of the Muttahida Majlis-e-Amal (MMA) party -- survived, police said. No group has yet claimed responsibility for that attack.

On Tuesday, a bomb claimed by the Pakistani Taliban targeted a rally by the Awami National Party (ANP) in the city of Peshawar.

Local ANP leader Haroon Bilour was among the 22 killed. Thousands flocked to his funeral the next day.

'Duty To Protect'

ISIS has a muted presence in Pakistan but has carried out brutal attacks there in the past, including the blast at a Sufi shrine in February last year which killed nearly 90 people.

Terrorists have targeted politicians, religious gatherings, security forces and even schools in Pakistan.

But security across the country has dramatically improved since government and military operations cleared large swathes of territory near the Afghan border in recent years.

Analysts warn, however, that Pakistan has yet to tackle the root causes of extremism, and terrorists retain the ability to carry out attacks.

Last month, a US air strike killed the leader of the Pakistani Taliban, Maulana Fazlullah, in neighbouring Afghanistan in what the Pakistani army called a "positive development" that also sparked fears of reprisals.

The military has warned of security threats in the run-up to the tense election on July 25, and said it will deploy more than 370,000 soldiers on polling day.

Activists called for Pakistani authorities to remain vigilant to protect candidates during the final days of the campaign season, already tense amid a stand-off between former premier Nawaz Sharif and the security establishment.

Sharif returned to Pakistan from London late Thursday and was arrested, one week after he was convicted in absentia on corruption charges and given a ten-year jail sentence.

He claims he is being targeted by the military, which remains the country's most powerful institution, and which has faced blistering allegations that it is pressuring the media and politicians in a bid to manipulate the polls against the PML-N.

It denies the accusations.

The election will pit the PML-N against its main rival, the Pakistan Tehreek-e-Insaf, a party led by cricket star-turned-politician Imran Khan.

"The Pakistani authorities have a duty to protect the rights of all Pakistanis during this election period -- their physical security and their ability to express their political views freely, regardless of which party they belong to," said Omar Waraich, deputy South Asia director at Amnesty International.