A Bangladeshi-born man who lived in Ontario and graduated from the University of Windsor was killed by Bangladeshi police Saturday morning over suspicions that he was the mastermind behind two attacks in the country’s capital.

Counterterrorism authorities said a SWAT team raided a two-storey building near Dhaka and killed Tamim Chowdhury, a Bangladeshi-Canadian who is suspected of plotting a July 1 attack on a café that killed nearly two dozen people.

There was an exchange of gunfire during the raid and two other suspected militants were killed, police said.

Officials believe Chowdhury also plotted a July 7 attack on an Eid congregation outside Dhaka marking the end of Ramadan. Four people, including two police officers, died in the attack.

The country’s police chief said Chowdhury and the two other alleged militants belonged to Jumatul Mujahedeen Bangladesh, or JMB, an Islamist terror group.

The Islamic State has called Chowdhury its “emir” -- or local head -- in Bangladesh and claimed responsibility for the café attack, but authorities have repeatedly denied that ISIS has any presence in the country.

Regardless, terrorism experts said Chowdhury was well known in the region.

"I think he had a unique role as head of ISIS in Bangladesh and perhaps to launch operations around South Asia as well. Seems to be that he was appointed or got approval to work on behalf of ISIS," said Amarnath Amarasingam, a post-doctoral fellow at the University of Waterloo who studies radicalization and terrorism.

"I don't think he will be easily replaced. It was a fledgling group which got snuffed out pretty quickly."

Few details are known about Chowdhury’s life in Canada. He grew up in Ontario and graduated with honours from the University of Windsor in 2011 with a degree in chemistry, according to records from the school. He left Canada in 2013 for Bangladesh, where he was born.

Canada’s Global Affairs department said it was aware of reports that Chowdhury had been killed and is working with local authorities to obtain more information.

Another Canadian link

Meanwhile, another Canadian man remains in custody in Bangladesh over his possible ties to the deadly Dhaka café attack.

Tahmid Hasib Khan, a 22-year-old University of Toronto student, was taken into custody immediately after the attack. Khan has not been charged, but under Bangladeshi law, key witnesses can be detained in prison.

Khan’s family has insisted that he is innocent and said he was in the café with friends when the attack unfolded.

Global Affairs said that there is little it can do for Khan because he is permanent resident and does not have Canadian citizenship. The agency said it has been in touch with Bangladeshi officials to monitor the situation.

With files from CTV News’ Kevin Gallagher and The Associated Press