(Adds details, minister quote)
By Serajul Quadir
DHAKA, Aug 27 (Reuters) - Bangladesh security forces killed three Islamist militants on Saturday including a Bangladesh-born Canadian citizen alleged to have masterminded an attack on a cafe in Dhaka last month in which 22 people, mostly foreigners, were killed, police said.
The militants were cornered in a hideout on the outskirts of the capital and, having refused to surrender, were killed in the ensuing gunbattle, Monirul Islam, the head of the Dhaka police counterterrorism unit, told Reuters.
He initially said four militants had been killed but later revised the number to three.
The success notched up by the security forces came ahead of a visit on Monday by U.S. Secretary of State John Kerry, who is expected to discuss security in the wake of a series of killings of liberals and religious minorities in the mostly Muslim country.
Islamic State claimed responsibility for the assault on the cafe in a posh neighbourhood of the capital, during which militants singled out non-Muslims and foreigners, killing Italians, Japanese, an American and an Indian. government has steadfastly denied the presence in the country of any transnational militant organisation, like al Qaeda or Islamic State.
But police believe that Jamaat-ul-Mujahideen Bangladesh, which has pledged allegiance to Islamic State, was involved in organising the cafe attack.
The scale of that attack and the targeting of foreigners has cast a shadow over foreign investment in the poor South Asian economy, whose $28 billion garments export industry is the world's second largest.
MASTERMIND'S DEATH
The suspected mastermind killed in Saturday's raid was identified as Tamim Ahmed Chowdhury, a 30-year-old Canadian citizen born in Bangladesh. Analysts say Islamic State in April identified Chowdhury as its national commander.
"According to our evidence we are now sure that Tamim was among the three killed," Home Minister Asaduzzaman Khan told reporters. "So the chapter of Tamim has ended here."
Khan said Chowdhury was one of the main suppliers of funds and arms for several recent attacks. He had returned to Bangladesh in October, 2013 via Abu Dhabi, A K M Shahidul Hoque, the inspector general of police, said.
The raid followed a tip off from the landlord of the house where the militants were staying, Hoque told reporters. The landlord said the militants had described themselves as businessmen in the medical trade.
Police have also been holding in detention two men who had been among the survivors of the attack on the restaurant.
Hasnat Karim, holds dual British and Bangladeshi citizenship, and Tahmid Hasib Khan, a student of Toronto University, had been dining separately in the restaurant.
A lawyer for Karim, a 47-year-old engineer, has said his client is innocent. Relatives of Khan, 22, say he is innocent too.
Earlier this month, security forces arrested four women suspected of being members of Jamaat-ul-Mujahideen Bangladesh.