A suicide bomber has killed at least 23 people and wounded dozens while they were attending prayers at a mosque in a northwestern Pakistani tribal area, sources tell Al Jazeera.

Friday's bombing occurred in the village of Anbar Tehsil in the Mohmand tribal district bordering Afghanistan where the Pakistani army has been battling the Pakistan Taliban. 

Pakistan Taliban reject peace talks

"The suicide bomber was in a crowded mosque, he shouted 'Allahu akbar' (God is greatest) and then there was a huge blast," Naveed Akbar, deputy administrator of Mohmand Agency, told Reuters news agency.

Akbar added that some fatalities appeared to had 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.

One of the wounded, 41-year-old Ghulam Khan, said he heard a deafening explosion during the prayers.

"I cried for help, but no one came to me ... there were other bodies ... wounded worshippers, who were reciting verses from Quran and waiting for help," he told the Associated Press news agency.

Khan said local residents and tribal police helped transport the wounded to hospital.

No claim of responsibility

There was no immediate claim of responsibility, but Pakistani Taliban in particular routinely attack soft targets such as courts, schools and mosques.

READ MORE: Deadly twin blasts hit court in Pakistan

The army launched an operation in June 2014 in a bid to wipe out armed groups bases in the northwestern tribal areas to bring an end to a violent campaign that has cost thousands of civilian lives since 2004.

Pakistan Taliban chief killed in drone strike

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

Security in Pakistan has improved in recent years - the military says "terrorist incidents" dropped from 128 in 2013 to 74 last year - but major attacks on soft targets are still common.

A bombing of lawyers in the city of Quetta killed 74 people last month, an attack claimed by both the Islamic State Iraq and the Levant (ISIL) and Jamaat-ur-Ahrar, a breakaway faction of the Pakistan Taliban.

Jamaat-ur-Ahrar also claimed the Easter Sunday bombing in a park in the eastern city of Lahore that killed 72 people, many of them children.

Source: Al Jazeera News And Agencies