Four militants, including the alleged mastermind of the Dhaka cafe attack have been killed by the Bangladesh security forces on Saturday, the head of Dhaka's counter-terrorism police unit told Reuters.

The Additional Commissioner of Police Monirul Islam said the militants were cornered in an early morning raid on their hideout in Narayanganj on the outskirts of Dhaka. He said the militants were asked to surrender, but they were killed after they refused to do so.

Tamim Ahmed Chowdhury, a Bangladesh-born Canadian citizen, who was the alleged mastermind of the Dhaka cafe attack that killed 22 people, was among those killed militants.

On July 1 evening, a group of Islamist militants killed 22 people, including 18 foreigners at the Holey Artisan Bakery Cafe in Dhaka. Later the police shot five of the attackers dead and rescued 13 hostages.

The suspected militants singled out non-Muslims and foreigner hostages in the attack.

The Islamic State (IS) claimed the responsibility of this attack but the Bangladesh government has always denied the existence of Islamic State militant group in Bangladesh and has blamed homegrown Islamists for the attacks.

The analysts said Islamic State identified Tamim Chowdhury as its national commander in April.