A small bomb exploded in a park in the Indonesian city of Bandung on Monday, with the attacker fleeing into government offices and engaging in a shootout with police.
No one was reported wounded in the assault in the major city on Java island which police said was linked to a "terrorist network". The attacker was captured after a standoff lasting about an hour.
After the blast, which reports said came from a bomb constructed out of a pressure cooker, the attacker fled into a building belonging to local authorities.
Television footage showed armed police exchanging fire with the man inside, and part of the building was set on fire.
Local police chief Anton Charliyan said no one had been hurt and everyone had been evacuated from the building.
"We tried to negotiate but instead the perpetrator tried to burn (the place)," he told local TV station MetroTV.
"He's from a terrorist network," he added, without elaborating.
Charliyan said the attacker, whom he did not identify, was injured during the standoff.
Indonesia, the world's most populous Muslim-majority country, has long struggled with Islamic militancy and was hit by series of attacks in the past 15 years, including the 2002 Bali bombings that killed 202 people, mostly foreign tourists.
A sustained crackdown weakened the most dangerous networks but the emergence of the Islamic State (IS) group has proved a potent new rallying cry for the country's radicals and hundreds flocked to the Middle East to fight with the jihadists.
A series of attacks and failed plots have been linked to IS supporters in Indonesia in recent years.