Credible law enforcement includes upholding due process, even for suspected terrorists. Indonesia has resisted the temptation to re-enact the draconian anti-subversive law, the equivalent of the Internal Security Act that neighboring Malaysia and Singapore have used to arrest anyone the authorities wish to without a warrant and to imprison people indefinitely without trial in the name of national security.

The prosecution of those suspected of having connections to terrorist networks — and there have been several hundred of them — has followed proper legal procedures. This includes the cases of the three chief perpetrators of the Bali bombings, who were sentenced to death and executed in 2008.

Many others convicted of terrorism have been released after serving time in prison, but not before undergoing a government-run “deradicalization” program. Here, the record is mixed: While some have renounced extremism, others have rejoined terrorist groups.

The main battle against Islamic extremism has always hinged on winning hearts and minds. Many Muslims are radicalized during indoctrination sessions held in small Quranic reading groups. A handful of Muslim boarding schools, known as pesantren, are suspected hotbeds of radicalism, and police intelligence is vital to penetrating them. But the battlefield that counts the most is the public square. We must fight terror with the full force of the law, but fight ideology with ideology.

Presidents Sukarno and Suharto, who between them ruled Indonesia from 1945 to 1998, made the mistake of outlawing radical Islamists at times, pushing them underground. Disparate Islamist groups then joined hands to fight their battles together. They became invincible and deadlier.

That changed in 1998, when Suharto was forced to step down, paving the way for Indonesia’s first truly democratic elections in four decades, in 1999. Since then, various Islamist groups have formed political parties and have won enough votes in the last four general elections to become junior partners in successive coalition governments. Nevertheless, political Islam doesn’t enjoy widespread support — the majority of Muslims in Indonesia have consistently voted for secular political parties.

The concept of an Islamic caliphate may resonate among some Indonesians, but many Muslim groups here have denounced the Islamic State for its barbaric violence. Even Abu Bakar Bashir, the Jemaah Islamiyah leader who is serving a 15-year prison term, lost many supporters after he reportedly led a handful of inmates last July in declaring support for the Islamic State. A month later, one of his sons clarified that they had pledged support for a caliphate, but did not recognize ISIS as its representative.