Police are seen outside Saint Joseph catholic church in Indonesia
© Irsan Mulyadi / Reuters Police are seen outside Saint Joseph catholic church after a suspected terror attack by a knife-wielding assailant on a priest during the Sunday service in Medan, North Sumatra, Indonesia August 28, 2016 in this photo taken by Antara Foto.
An 18-year-old has been detained after a failed attempt to detonate a bomb in a crowded church in western Indonesia, local police said. When the attempt failed, he reportedly struck a priest with an ax.

The teen ran towards the alter during Sunday Mass at the Roman Catholic St. Yoseph Church in Medan, the capital of North Sumatra province. However, the bomb he had been carrying in the backpack did not explode, national police spokesman Major General Boy Rafli Amar told AP.

Other police sources said that the device had been homemade and said it was more like a "firecracker."

"Somebody tried to kill the priest by pretending to attend the church service and at that time tried to explode something, like a firecracker, but the firecracker didn't explode, it only fumed," local chief detective Nur Fallah said, as quoted by AFP.

However, the would-be suicide bomber didn't stop there: he took an ax from his backpack, and attacked 60-year-old priest Albert Pandiangan, AP reported. Other sources said the assailant assaulted the priest with a knife.

Luckily, the priest did not suffer the same fate as the 84-year-old Jacques Hamel, whose throat was slit by an Islamic State-linked attacker in northern France back in July. The Indonesian priest's hand was slightly injured in the attack, and the assailant was restrained by the congregation.

The motive for the attack presently remains unclear. Police are now interrogating the 18-year-old attacker, who told them he had accomplices, AP reported citing national police spokesman Amar.

The assailant allegedly carried a symbol indicating support for Islamic State (IS, formerly ISIS/ISIL).

A picture of the attacker's alleged ID has emerged online, and it said he is Muslim.

Indonesia is the world's most populous Muslim nation, but has been hit by violent militant attacks since the 2002 Bali bombings that left over 200 people dead.