Police in Pakistan have detained 23 people in connection to a blast at a mosque inside a police headquarters that killed 101 people, a senior official who asked not to be named said Wednesday.

Authorities are also probing the possibility that people inside the compound helped to coordinate the attack, the senior provincial police official told AFP on condition of anonymity.

A suicide bomber slipped undetected into a highly sensitive compound in northwest Peshawar and detonated explosives among a row of worshippers in the compound's mosque on Monday, causing a wall to collapse and crush officers.

"We have detained people from the police line (headquarters) to get to the bottom of how the explosive material made its way in and to see if any police officials were also involved in the attack," the senior official said.

"The attacker and facilitators might have had links outside Pakistan."

He said some among the 23 detained were also from the city and nearby former tribal areas which border Afghanistan.

Authorities are investigating how a major security breach could happen in one of the most tightly controlled areas of the city, housing intelligence and counter-terrorism bureaus, and next door to the regional secretariat.

Low-level militancy, often targeting security checkpoints, has been steadily rising in the areas near Peshawar that border Afghanistan since the Taliban seized control of Kabul in August 2021.

The assaults are claimed mostly by the Pakistani Taliban, as well as the local chapter of the Islamic State, but mass casualty attacks remain rare.

Moazzam Jah Ansari, the head of Khyber Pakhtunkhwa province police force, on Tuesday told reporters that a suicide bomber had entered the mosque as a guest, using 10-12 kilogrammes (about 22-26 pounds) of explosive material earlier brought to the site in bits and pieces.

He added that a militant group that was on-and-off affiliated with the Pakistani Taliban could be behind the attack.

Pakistan is already being hobbled by a massive economic downturn and political chaos, ahead of elections due by October.