A homicide bomber blew himself up in a mosque packed with hundreds of worshippers for Friday prayers in northwestern Pakistan, killing at least 48 people and injuring scores more, officials said.

The blast badly damaged the mosque in Jamrud, a town near the Afghan border in an area beset by Taliban attacks as well as vicious feuds between rival tribes and militant groups. Authorities did not immediately speculate on a motive.

Rising violence in Pakistan's northwest is fueling doubts about the country's ability to counter Taliban and Al Qaeda militants also blamed for attacks in neighboring Afghanistan.

Television footage showed scores residents and police officers digging frantically through the ruins of the white-walled mosque, whose roof appeared to have caved in.

The bomber struck when about 250 people were attending Friday prayers, said Tariq Hayat, the top administrator in the area.

He said rescuers had pulled 48 bodies from the rubble and predicted the toll would likely rise further. Another 80 people were injured, he said.

"We are struggling to find the survivors," Hayat told Geo television by telephone.

Jamrud lies in the semiautonomous Khyber tribal region, where militants have intensified attacks on trucks carrying supplies to NATO and U.S. forces in Afghanistan.

While the motive for Friday's attack was not immediately clear, feuding militant groups in the area have carried out a string of tit-for-tat attacks, including attacks on mosques.