A suspected Islamist militant who was arrested for the murderous attack on a Hindu college teacher has been killed in a shootout in Bangladesh.

Madaripur police chief Sarwar Hossain said the militant, identified as Ghulam Faijullaha Fahim, was shot when the police officers took him along with them to help capture his associates in Miarchar area at Sadar upazila.

"He was caught in crossfire that erupted after miscreants started shooting at the police," Hossain told Reuters. The shootout left Fahim critically injured and he was announced dead on arrival at a hospital.

Ripon Chakraborty, a mathematics teacher, was attacked by Fahim and two other people on Wednesday at his home in Madaripur.

Several people who rushed to the rescue of the teacher and his family somehow managed to get hold of Fahim and they handed him over to the police. Fahim was put on a 10-day remand and during the interrogation he told the police that the attack was planned by the members of Hizb ut-Tahrir, a banned militant group.

Since last year, the militants have killed more than 30 people including bloggers, liberal academics, gay rights campaigners, foreign aid workers, and members of minority Muslim sects and other religious groups.