Indonesian police mounted a daring raid on a high-security detention centre yesterday morning, ending a two-night stand-off with more than 150 terrorist inmates.

Crack commandos broke through a wall and used stun grenades to neutralise the inmates before taking back the facility in Kelapa Dua, some 36 hours after the siege started.

The detention centre, just 25km from the city centre of Jakarta, houses a number of Islamist militants jailed on terror-related charges.

The siege, started on Tuesday night by 156 inmates who support the Islamic State in Iraq and Syria (ISIS), resulted in the deaths of five officers from the counter-terrorism police force. Their bodies showed signs of torture before their throats were slit. Four other officers were injured.

One of the inmates was also killed during the initial stage of the violence, which was posted on the Telegram messaging application by several perpetrators who had mobile phones.

Police deployed reinforcements from the military and had them on standby and also negotiated with the inmates in a bid to secure the release of hostages.

Before dawn yesterday, 145 inmates surrendered, Coordinating Minister for Political, Legal and Security Affairs Wiranto told reporters.

Just before 7.30am, an explosion and gunshots were heard at the facility.

Speaking to reporters later in the morning, the deputy police chief, Commissioner General Syafruddin, said the explosion was meant "to sterilise the site" before officers stormed in.

Police Mobile Brigade (Brimob) commander Rudy Sufahriadi added that the blast "was to bring down a wall of a room where we figured they placed homemade bombs".

After the raid, the remaining 10 inmates surrendered.

"We dealt with this (stand-off) using a soft and persuasive approach, although our colleagues have fallen victimto their sadistic acts," said General Syafruddin.

Police said the mayhem was sparked when inmate Wawan Kurniawan, alias Abu Afif, a member of the Jemaah Ansharut Daulah terrorist group, became furious that guards would not allow visiting family members to give him food on Tuesday.

The police clarified that it was a misunderstanding, saying that officers required the meals to be inspected first.

At around 8pm that night, Wawan incited other inmates to try to break free. A group of five to 10 inmates in a cell managed to break open the cell door.

They then stormed into an interrogation room, where they snatched the weapon of a female officer and beat her up. She is among the four injured officers.

The group went into a storeroom which holds confiscated items from raids and took assault rifles, pistols, ammunition and home-made bombs.

They attacked other officers and held them hostage.

Five of the hostages were killed, three were freed hours later on Tuesday, and the last one was freed at around 2am yesterday.

The inmates had asked for food in exchange for the release of the last hostage, Kompas.com cited police spokesman Muhammad Iqbal as saying.

Terrorism expert Haris Abu Ulya blamed the incident on the complacency of the police who underestimated what the terrorists were capable of doing.

The terrorists' enormous hatred of the police and their wrong belief that the police are the accomplices of the infidels drove them to "commit such anarchic acts and killings", Mr Haris told Indonesia's largest radio station Elshinta.

All the terrorist inmates have been transferred to Nusakambangan, Indonesia's Alcatraz-like island prison.