MOHMAND AGENCY - A Taliban suicide bomber blew himself up in a packed mosque in northwestern Mohmand tribal district, killing at least 28 people and wounding 30 others during Friday prayers, local officials said.

The bombing came in a village of Ambar tehsil of lower Mohmand Sub-division, some 65 kilometers northeast of the Agency headquarter Ghalanai.

Lower Mohmand Assistant Political Agent (APA), Naveed Akbar told The Nation that blast occurred when around 200 worshippers were gathered for the Jumma prayers in the local Jamia mosque (Gul Masjid) in Payee Khan village.

The victims include four children, aged 10 or younger, who were killed in the attack, he said, adding that a curfew has been imposed in the area.

Mohmand Agency borders Afghanistan and it was a hub of TTP and other militant organisations before the area was cleansed in an intensive military operation.

Taliban faction Jamaat-ul-Ahrar (JuA) claimed responsibility for the attack, saying it was carried out to avenge the deaths of 13 of its members and arrests of others by a local vigilante force in 2009.

“I was offering Sunnah prayers when I heard someone shouting “Allahu Akbar” and the next moment there was a loud bang, said an eye witness, Abdul Sattar, who was among the injured and had been brought to a hospital in Ghalanai. The bomber had struck them in the verandah of the mosque, he added.

Another resident of the area, Malang Jan, said that he was praying in the same mosque in the first row when the blast came. “When I rushed out I saw body parts of the victims even in the open fields near the mosque,” he said.

“There were bodies and blood everywhere in the verandah which was badly destroyed,” said yet another eyewitness. He said that most of the injured were waiting for vehicles because there were no proper arrangements of transportation in the area.

APA Naveed Akbar said that some fatalities appear to have been caused when part of the mosque caved in from the force of the blast. "A portion of the mosque and verandah collapsed in the blast and fell on worshippers. We are still retrieving bodies and the injured from the rubble of the mosque," he said.

Akbar said that after the incident rescue teams and ambulances were sent to the area while Political Agent Mahmood Alsam was also went to the spot to supervise the rescue activities.

He said that most of the injured persons were shifted to Agency Headquarters Hospital Khar for treatment while some were taken to the Agency Headquarters Hospital Ghalanai.

It was also learnt that the regular prayer leader of the mosque was not present at that time and the prayer was led by another person.

Security forces cordoned off the area and started a search operation in and around the attacked area.

PM Nawaz Sharif condemned the bombing and said the "attacks by terrorists cannot shatter the government's resolve to eliminate terrorism from the country."

President Mamnoon Hussain, in a statement, also condemned the bombing and said that terrorists will be dealt with iron hands.

Since 2007 the government has encouraged vigilante forces comprising tribesmen -- locally known as peace committees -- to defend their villages against the Taliban.

A local tribal elder Haji Subhanullah Mohmand said the attack may have been carried out by militants seeking revenge after local tribesmen gathered a volunteer force. "It seems to have enraged the militants and they got their revenge by carrying out the suicide attack in a mosque today," he said.

"Today our suicide bomber has attacked the so-called peace lashkar (vigilante force) in Mohmand Agency's Anbar district," the JuA spokesman Ehsanullah Ehsan said in an email to reporters.

"We warn all the lashkar members of Anbar and supporters of military to quit opposition to Islam and Jihad and refrain from enmity with Mujahedin (holy warriors) otherwise our war is being extended," Ehsan said.

Last month, a bomb targeting lawyers in Quetta killed 74 people. The attack was claimed by both the Islamic State and Jamaat-ur-Ahrar, which had also claimed the Easter Sunday bombing in a park in the eastern city of Lahore that killed 72 people.

Pakistan's frontier regions, which are deeply conservative and hard to access due to rough terrain, have long been the sanctuary of fighters from al Qaeda, the Taliban and other militant groups. In 2014 the army launched a major operation in other parts of Fata, including North and South Waziristan, against insurgents.

Security has improved in recent years - the military says "terrorist incidents" dropped from 128 in 2013 to 74 last year - but Islamist extremists continue to stage attacks in the country.

On Thursday last, a woman was killed in a hand grenade attack in Lower Mohmand Agency when unidentified militants lobbed grenades and opened fire at the house of a pro-government tribal elder - Malik Nasir Khan - in Shah Alam Sali, Michni.

Earlier this month, at least 14 people were killed and 52 others injured in a suicide attack at Mardan’s district courts. Six lawyers and two policemen were among the dead.