Hard-line Islamist parties must also contend with a “tolerant,” eclectic version of Islam that has been present in Indonesia since the religion first came to the Southeast Asian island in the 13th century, via Arab and Indian traders, Tepperman notes. But he adds that more orthodox Sunni practices from the Middle East have been widely embraced in Indonesia over the last few decades.

Yet while Indonesian Muslims—who constitute nearly 90 percent of the population—now tend to be more openly devout than they were under the largely secular rule of Suharto, few have extremist religious beliefs. Over 70 percent of Indonesian Muslims support making sharia, or Islamic law, the nation’s legal code, according to a 2012 Pew survey—a higher percentage than in Muslim-majority countries like Tunisia and Turkey, but lower than in states such as Iraq and Malaysia. Four percent of Indonesians have a favorable view of ISIS, according to another recent survey. Six percent of Indonesian Muslims say suicide bombing in defense of Islam is often or sometimes justified—a small percentage that has only gotten smaller over the last decade and a half.

“Indonesia’s success against radicalism has nothing to do with secularism,” Tepperman told me. “The country is steadily becoming more pious, and yet it’s becoming less radical at the same time.”

3) Bring Islamist parties into government

“What you see in countries like Egypt, Syria, elsewhere is: The worst thing that you can do to Islamist parties is ban them from government entirely, because that lets them promise everything under the moon, preserve an immaculate reputation, and present themselves as tribunes of the oppressed people,” Tepperman told me.

SBY, by contrast, brought several Islamist parties into his coalition and cabinet—in part to amass sufficient legislative support to govern, but also, Tepperman suspects, to co-opt the Islamists and expose them as ordinary politicians, not saviors. “Sure enough, like you’ve seen in places like Gaza with Hamas and in Egypt with the Muslim Brotherhood, these parties tend not to be very good at actually governing,” Tepperman said. Islamist politicians in Indonesia have, for instance, been busted for taking bribes and even watching porn in the legislature.

4) Go after terrorists hard

Terrorist attacks in Indonesia spiked following Suharto’s fall, culminating in bombings on the island of Bali in 2002 that killed over 200 people. In response, Megawati created a counterterrorism unit called Densus (Detachment) 88 that, with U.S. and Australian assistance, has aggressively targeted militants ever since. (In July, Indonesian security forces killed the country’s most notorious jihadist, Santoso, who had pledged loyalty to ISIS.)

Still, the gains in counterterrorism—terrorist groups have been dismantled, and attacks in the country have declined, if unevenly, since 2002—have come at a cost. Densus 88 has been accused of torturing detainees, killing suspected terrorists when they could have been captured and put on trial, and committing other human-rights violations.