Police said the explosion in the Bajaur district, bordering Afghanistan, was caused by a suicide bomb.
However, no group claimed responsibility for the attack at a political convention by the conservative Jamiat Ulema-e-Islam party (JUI-F), a government coalition partner, ahead of elections later this year.
More than 500 supporters were gathered in the event under the tent when the blast occurred on Sunday afternoon.
Footage showed people at the convention panicking after the blast, with ambulances arriving to transfer the injured to hospitals.
The district health officer Dr Muhammad Faisal told the Guardian that 40 dead bodies and 150 injured were brought to District Headquarters hospital in Bajaur.
“The death toll could rise further”, he said, adding that 20 injured people were in critical conditions.
A health emergency was declared in the district hospital and in adjoining areas, while some patients were moved by helicopter to Peshawar hospitals.
Bajaur district emergency officer Saad Khan stated the powerful explosion happened when the JUI-F leaders were addressing the gathering. Maulana Ziaullah Jan, a key JUI-F leader of the Khar area, was killed in the blast.
Political gatherings and meetings are being held across the country to mobilise supporters for the coming general elections, due in October. Pakistan’s government is due to dissolve in the next few weeks and political parties have started preparing the campaigns.
Bajaur is one of several remote districts bordering Afghanistan in a region known for militancy in the past. The area remained a focus in the global “war on terror” in previous decades.
There has been a sharp rise in attacks in Pakistan since the Taliban returned to power in neighbouring Afghanistan in 2021.
Afghanistan’s Taliban government condemned Sunday’s blast in a statement by their spokesperson, Zabihullah Mujahid.
Pakistan’s military says militants are operating from the safe havens in neighbouring Afghanistan and has threatened to an “effective response” in the wake of the recent attacks in the country.
Pakistan’s local Taliban group, the Tehreek–e-Taliban Pakistan, known as TTP, has increased its attacks on security officials, including army and the police officers.
In January, a TTP suicide bomber blew himself up in a mosque inside a police compound in the north-western city of Peshawar, killing more than 80 officers.