Jolo, Philippines: Philippine police said Sunday they were hunting for 12 inmates who escaped from a jail on a southern island that is the stronghold of Islamist militants.

The detainees were among 29 inmates who bolted from a prison inside a police station in war-torn Jolo on Saturday where they were being held mostly on drugs charges. The remaining 17 were recaptured the same day, police said.

Jolo is a base for the Abu Sayyaf kidnap-for-ransom group and authorities said they were investigating whether or not the inmates who escaped had links with the militants.

“A guard went on break, went to the toilet and when he left, the inmates found a way to escape. They picked the lock of the jail cell and fled,” regional police spokesman Senior Inspector Jemar delos Santos told AFP.

“We are heightening security around the perimeter of the island municipality and securing ports so that they would not be able to leave Jolo.”

The jail had a capacity of about 50 inmates and was located near a port, Delos Santos added.

Police replaced all the prison guards as they probed the jailbreak.

The Philippines frequently has mass escapes from prisons, which are usually overcrowded, poorly maintained and inadequately guarded.

In the country’s biggest jailbreak, more than 150 inmates escaped a prison in the southern Philippines in January last year after about a hundred gunmen stormed the facility.

In July 2017, three inmates were killed and another was wounded as 14 prisoners escaped from a jail in Jolo.

Islamist militants in the mainly Catholic nation including Abu Sayyaf members pledged allegiance to the Islamic State group as they went on a rampage in the southern city of Marawi.

The five-month siege flattened Marawi, claimed more than 1,100 lives and sparked fears IS was seeking to establish a regional base.