A terrorist attack at a crowded Catholic church in Indonesia on Sunday was narrowly averted, when a would-be Islamist suicide bomber failed to detonate his vest.

The 17-year-old suspect entered a church in the Sumatran city of Medan during the Sunday service, according to the Jakarta Globe. He rushed toward the priest who was leading the service and tried to stab him before setting off the vest, an action that only produced sparks. The priest, meanwhile, escaped unhurt except for a few scratches on his arm.

Read next: Indonesia’s Overcrowded Prisons Are a Breeding Ground for Islamic Extremism

The assailant, who was carrying an ax and a pipe bomb in his backpack along with the knife and vest, was immediately captured by church attendees and subsequently turned over to authorities. A police official told the Globe that a drawing resembling the ISIS flag was recovered at the scene.

According to local publication Tempo, the Southeast Asian nation’s top security minister, Wiranto, said the attacker was a “lone wolf” and not affiliated with any particular group.

However, Wiranto added that the teenager was “obsessed” with ISIS leader Abu Bakr al-Baghdadi, based on videos recovered from his cellphone and a note on his backpack that read “I Love al-Baghdadi.”

Read next: ISIS Has Launched a Newspaper to Recruit Southeast Asian Fighters

Muslim-majority Indonesia has seen an uptick in Islamic extremism this year, with fatal bombings in Jakarta in January followed by multiple attempted attacks — the last of which took place in early July.

[Jakarta Globe]

Get The Brief. Sign up to receive the top stories you need to know right now. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Write to Rishi Iyengar at rishi.iyengar@timeasia.com.