Six people were killed and nearly 40 others injured, including a top intelligence officer, in two powerful blasts outside a building occupied by the Islamist militants as commandos prepared for a final assault to flush them out in Sylhet city in Bangladesh, police said on Sunday.

The first blast happened around 7:00 p.m. on Saturday about 400 metres off the five-storey building where the militants were holed up. It targeted the huge crowd witnessing the operation codenamed ‘Twilight’ and policemen deployed there.

Another blast took place in front of the hideout an hour later.

Six people including two police officers were killed in the attack. The dead included two police inspectors and four onlookers, two of them being college students.

Hours later the Islamic State claimed responsibility for the attack through its propaganda news agency ‘Amaq’

The target of the attack was security forces, it said.

This was the third attack in Bangladesh in eight days for which the ISIS claimed credit.

Elite Rapid Action Battalion (RAB) Intelligence Wing chief Lt Col Abul Kalam was seriously wounded in blasts and flown to Dhaka for treatment.

Citing one of the injured people, bdnews24.com said that the second blast took place when RAB and police personnel went to the spot after the first blast.

“A ban has been enforced barring entry of ordinary people within the vicinity of the building as final preparations were underway to flush the militants out from their den,” a police officer told reporters.

Sylhet-based 17 Infantry Division’s Major General Anwarul Momen is leading the operation, which was assisted by police’s SWAT and counter-terrorism units. The elite Rapid Action Battalion is also involved.

Police had raided the building early morning on Friday and cordoned off the area.

Counter-Terrorism and Transnational Crime (CTTC) chief Monirul Islam said they got information that JMB chief Musa along with some other JMB militants were in Sylhet, but it was not clear if they were the ones hiding in the building.

The neo-JMB, said to be inclined to the Islamic State, was behind the July 1 terror attack on a Dhaka cafe in which 22 people, including 17 foreigners, were killed.

TV channels were barred from broadcasting the operation “live” but their reports showed commandos taking positions around the building.

Eyewitnesses said sounds of intermittent gunshots and explosions were heard, indicating militants response to the security siege that continued for the last three days.

The Operation Twilight was launched after a suicide bomber on Friday night blew himself up at the international airport in Dhaka in an attack claimed by the ISIS. It came a week after an identical attack on a RAB camp in Dhaka.

Police had tracked down the Sylhet hideout less than a week after they busted two militant dens on the outskirts of the southeastern port city Chittagong.

Bangladesh has been witnessing a spate of attacks on secular activists, foreigners and religious minorities since 2013. The country launched a massive crackdown on militants specially after the Dhaka cafe attack.