DEPOK, Indonesia (Reuters) - A hostage crisis at a high-security jail in Indonesia ended on Thursday after Islamist militant prisoners who killed five police surrendered and released an officer they were holding, authorities said.

The five members of an elite counter-terrorism force had been “sadistically” killed by prisoners during the 36-hour standoff, which officials called an “act of terror” at the jail on the outskirts of the capital Jakarta.

“We have minimized the number of victims. The operation ended at 7:15,” deputy chief of national police Syafruddin told reporters.

Four other police were injured and one inmate killed in the incident which began late on Tuesday.

The death toll was the highest suffered by the counter-terrorism police force, known as Detachment, or ‘Densus’, 88, which was set up in 2003 with funding and training from Australia and the United States.

Indonesian President Joko Widodo thanked security forces for their efforts in containing the crisis.

“The state and all the people are never afraid and will never give the slightest room to terrorism and also to efforts that undermine the security of the country,” Widodo told a news conference.

Syafruddin said the crisis was resolved with a “very soft approach”, although earlier on Thursday a Reuters witness had heard several blasts at the jail. Indonesian media reported those blasts were controlled explosions carried out by police to clear the area of any booby traps.

Chief security minister Wiranto told reporters that all 155 convicted terrorists who were involved had surrendered after a police “ambush” forced the last 10 convicts to give up.

Slideshow ( 8 images )

All the convicts were moved to a maximum-security prison on Nusakambangan Island in central Java.

PRISONERS SEIZED WEAPONS

Authorities said the prisoners had armed themselves with about 30 weapons, including long-range rifles, taken from officers and a storage area in the jail for weapons confiscated during police operations.

Deputy police chief Syafruddin said “five officers were killed sadistically”, and a police spokesman said most were found with deep wounds to the neck and elsewhere on their bodies. One officer was found with a gunshot wound to the head.

Funerals were held on Thursday for the police victims, including one officer who had recently become a father, media said.

Former Jakarta governor Basuki Tjahaja Purnama, an ethnic Chinese Christian who is serving a sentence for blasphemy against Islam at the same prison, was safe and still in the jail, his sister Fifi Lety Indra said.

The counter-terrorism squad has won international praise for breaking up militant cells in the world’s largest Muslim-majority country in the years since the Sept. 11, 2001, attacks on the United States.

But a recent spate of attacks inspired by Islamic State prompted authorities to more than double its strength to 1,300 late last year.

Slideshow ( 8 images )

Islamic State claimed responsibility for the clashes at the jail, in a message carried on its Amaq news agency.

Police had denied Islamic State was involved and said a dispute had broken out over checks by prison authorities of prisoners’ food.

But police also said some prisoners had recently met Aman Abdurrahman, who is believed to be the ideological leader of IS sympathizers in Indonesia. He is on trial for terrorism and is being held at the same prison.

Last year, an attack by two suicide bombers, using pressure cookers packed with explosives, killed three police and wounded 12 people at a Jakarta bus terminal.

In January 2016, four Islamic State-linked militants mounted a gun-and-bomb attack at an intersection outside a Starbucks cafe in central Jakarta, killing themselves and four others.