As many as eight fighters blew themselves up with a grenade in Bangladesh rather than surrender, police said on Thursday, the latest clash in the South Asian country that has seen a rise in violence.

Police urged the group, holed up in their hideout in Nasirpur, northeast of the capital Dhaka, to give themselves up on Wednesday, but instead they detonated the explosive.

Police officers came under attack during the operation with at least eight grenades tossed at them as they cordoned off two houses, both owned by a Bangladesh-origin British citizen.

Counter-terrorism officers and the elite SWAT unit then stormed one of the hideouts and found body parts scattered across two rooms.

"Up to eight militants, including a female, were killed," Monirul Islam, the chief of police counter-terrorism and transnational crime, told reporters.

He added there could also be children among the dead.

"There was an explosion late yesterday afternoon when the operation began. They died due to that explosion," Islam said.

On Monday, Bangladesh army commandos killed four fighters in the northeastern city of Sylhet during a raid on a building where they were holed up.

On Saturday, six people, including two police, were killed and more than 40 wounded in two bomb blasts near the hideout in the Sylhet building.

Islamic State of Iraq and the Levant (ISIL) claimed responsibility "for a bombing on Bangladeshi forces in Sylhet", the SITE monitoring service said, citing a report on the group's website Amaq, which appeared to refer to that incident.

The government rejected the claim and instead blamed the banned homegrown organisation Jamayetul Mujahideen Bangladesh (JMB).

Bangladesh anti-terror raids: Civilians killed in blast

ISIL and al-Qaeda have made competing claims over killings of foreigners, liberals, and members of religious minorities in Bangladesh, a mostly Muslim country of 160 million people.

The government has consistently ruled out the presence of such groups, blaming domestic attackers instead.

Analysts say they pose a growing danger in conservative Bangladesh, which has been roiled by political turmoil and instability for years.