Image copyright BBC Bengali Image caption Police believe that dozens of extremists are still in hiding

Police in Bangladesh have killed nine suspected Islamist militants after a gun battle in Dhaka, officials said.

Police were searching the residential area of Kallyanpur when they were attacked by handmade bombs.

Bangladesh has seen a string of deadly attacks on secular writers, bloggers, and member of religious minorities.

Earlier this month 20 people, mostly foreigners, were killed in a bloody attack on an upmarket cafe in Dhaka.

It was not immediately clear which group the suspected militants killed on Tuesday were part of. One suspect was taken into custody by police.

Image copyright BBC Bengali Image caption A crowd gathered near the scene of the raid

Image copyright BBC Bengali Image caption Nine suspected militants were killed

On 1 July, five armed men entered the Holey Artisan Bakery in the diplomatic area and held people hostage for several hours. At least 20 people died in an attack claimed by Islamic State.

Since the attack, police have been conducting planned "block raids" in suspected militant hideouts.

It was during one of these regular searches that the police came under attack on Tuesday, according to Deputy Police Commissioner Masud Ahmed, and retaliated with gun fire.

Analysis: The BBC's Anbarasan Ethirajan in Dhaka

This is the first time several suspected Islamist militants have been killed in an operation since the Holey Artisan bakery siege. It is not yet clear which group they belonged to.

Police believe that dozens of extremists are still in hiding and may be planning further attacks. The security forces have been under intense criticism for failing to prevent recent attacks and the targeted killings in the past three years.

The Bangladeshi government says home-grown extremists are responsible for the violence. But the so-called Islamic State and Al-Qaeda in South Asia have claimed to have carried out some of these attacks.