A spokesman for the Taliban in Pakistan has claimed responsibility for a suicide bomb attack at a police officer's funeral in southwestern Pakistan on Thursday that killed 30 people gathered to mourn a man shot dead earlier that day in front of his children.

In a telephone call from an undisclosed location, Shahidullah Shahid said the Taliban carried out the bombing to punish police officers in Quetta as they were "working against Islam." He did not elaborate.

The bombing is one of the more audacious assaults in a series of attacks targeting security forces in Pakistan, where insurgent Pakistani Taliban fighters routinely kill woefully under-equipped police officers.

The funeral was being held in an open field outside a mosque in Quetta, the capital of Baluchistan province, which is also home to separatists who have been waging a low-level insurgency against the governments for decades, but they rarely carry out suicide bombings.

Around 250 people gathered for the service.

Fayaz Sumbal, the head of police operations in Baluchistan, noticed the bomber near the gate of the mosque before he detonated his explosives, police official Mohammed Aslam said. Sumbal called on officers to question the bomber, who then blew himself up, Aslam said. Sumbal died in the blast.

Majority of victims were police

Most of the 30 dead and 55 wounded in the suicide bombing were police officers, Aslam said. They had gathered for the funeral of an officer gunned down earlier in the day as he traveled through the city in a vehicle with his children, city police chief Mir Zubair Mehmood said. Two of his children were wounded in the attack.

Provincial police chief Mushtaq Sukhaira said the attack could not deter the resolve of the police in the fight against terrorism. He said 21 police officers and nine civilians were killed in the attack.

A police constable, Hassan Jan, said he saw bodies of his fellow officers and colleagues after the blast.

"I am very sad for those who lost their lives in today's suicide attack," he said.

The bombing comes after a massive jailbreak in July orchestrated by Taliban fighters that authorities had prior warning about, but still couldn't stop.

The attack also came a day before Muslims in Pakistan were to start celebrating the Eid al-Fitr holiday that marks the end of fasting month of Ramadan. Millions of Muslims elsewhere in the world began celebrating Eid on Thursday but Pakistan and some other nations start on Friday.