Indonesian police said Monday that a man whose home-made bomb accidentally exploded in the West Java city of Bandung was obsessed with the idea of joining Islamic State group-affiliated militants who've occupied parts of a city in the southern Philippines since mid-May.

West Java police spokesman Yusri Yunus said that Agus Wiguna, 21, was arrested following the explosion on Saturday at his rented house and was probably acting alone.

Yunus said a written document found in the house showed Agus' pledge of allegiance to IS leader Abu Bakr al-Baghdadi. He said that Wiguna learned about IS and how to assemble a bomb from the internet.

The pressure cooker bomb allegedly prepared by Wiguna exploded unintentionally but caused no casualties. It was the second terror-related incident in Bandung since February, when police shot a suspected militant after his bomb exploded in a vacant lot and he fled into a municipal building and set it alight.

Police said Wiguna planned to begin his attack on July 16 at a cafe, then a restaurant and a church, all in Bandung.

He also admitted to wanting to join IS militants fighting in the Philippine city of Marawi after carrying out his planned attacks.

"That is his confession, but we still need a deeper investigation," Yunus said.

Indonesian police have arrested more than 40 suspected militants following a twin suicide bombing on May 24 in Jakarta that killed three officers and injured 11 other people, including five civilians, in the deadliest militant attack in the capital in a year.

The Jakarta attack was blamed on members of Jemaah Anshorut Daulah, a network of Indonesian extremist groups that has pledged allegiance to the Islamic State group.

Southeast Asian neighbors Indonesia, Malaysia and the Philippines have agreed to intensify their fight against violent Islamic militants. Analysts say the southern Philippines is at risk of becoming a new IS base as territory it controls in Syria and Iraq is captured by an international coalition seeking to defeat the group.