DHAKA (Reuters) - Three suspected members of an Islamist militant group blamed for a deadly cafe attack in Bangladesh last July were killed on Thursday when their suicide vests exploded during a police raid on their hideout, a police official said.

Police said a woman was also among the four dead, who belonged to a faction of the Jamaat-ul-Mujahideen Bangladesh group, known as New JMB, which they have linked to attacks such as that on the cafe, which killed 22 people, mostly foreigners.

New JMB has pledged allegiance to the Islamic State militant group, which claimed responsibility for the attack on the cafe in Dhaka’s diplomatic quarter, although the government has cast doubt on that claim.

Two policemen were wounded when the militants inside a two-storey building in Chittagong, about 200 km (120 miles) southeast of Dhaka, showered at least a dozen grenades on them, police official Mohammad Moniruzzaman told Reuters.

“The operation is over,” he said. “Our intelligence and bomb disposal and forensic units are now working.”

About 20 residents trapped in the building after Wednesday night’s raid began were taken to safety before the final assault started early on Thursday, Moniruzzaman said, adding that authorities also seized live grenades and a lot of explosives.

The militants shouted “Allahu akbar” or “God is greatest” as they started attacking police commandos, said Shafiqul Islam, a senior police official in Chittagong.

“They were wearing suicide vests which exploded,” he told Reuters, referring to the three men who died. “We are not sure whether they detonated the vests themselves, or they exploded after being hit by bullets. The woman was shot by us.”

The dead had yet to be identified because their bodies had been reduced to fragments, he added.

“We suspect the militants might have had plans to attack foreigners in the city,” he said, but did not elaborate.

Al Qaeda and Islamic State have made competing claims over a recent spate of killings of liberals and members of religious minorities in Bangladesh, a mostly Muslim country of 160 million people.

Authorities have consistently ruled out the presence of such transnational groups, blaming domestic militants instead, though security experts say the scale and sophistication of the cafe attack suggested links to a transnational network.

Police have killed more than 50 suspected militants in shootouts since the cafe attack, including the man they say was its main planner, Bangladesh-born Canadian citizen Tamim Ahmed Chowdhury.