A coup in Thailand. A landslide electoral victory in Egypt for a former military chief who overthrew an elected government. Democracy remains elusive in much of Southeast Asia and in much of the Muslim world. Yet, one Muslim-majority country in Southeast Asia proves it is not necessarily so.

Indonesia, which holds both parliamentary and presidential elections this year, is a testament to transformation. In 2001, three years after the fall of authoritarian President Suharto, Indonesia faced a multitude of crises, from Christian-Muslim sectarian strife and Islamist terrorist attacks, to separatist conflicts. That year, Thaksin Shinawatra won elections by landslide and became Thailand’s Prime Minister, but Indonesia’s first democratically elected President, Abdurrahman Wahid, popularly known as Gus Dur, was forced to step down after months of wrangling with lawmakers.

And yet, instead of turning to the men in uniform, Indonesia pressed ahead with political reform — reformasi, as it’s called in Bahasa Indonesia. In 2004, it not only held its first directly elected presidential vote (Gus Dur was elected by legislators), but the military lost its reserved parliamentary seats. “Reformasi achieved a great accomplishment for Indonesian democracy: pushing the military back into the barracks,” says Ulil Abshar Abdalla, an associate researcher at the Jakarta-based think tank Freedom Institute.

On July 9, Indonesia is set to choose its next President, in the third poll in which voters can directly elect their country’s top leader. The two presidential contenders are polar opposites. Joko Widodo is a soft-spoken and immensely popular Jakarta Governor. Prabowo Subianto is a former special-forces commander with a dubious human-rights record and infamously fiery temper.

Prabowo’s camp touts the ex-general as a decisive and firm leader, while Joko’s camp takes pride in his humble and down-to-earth quality. “One represents the culture of a tough military commander, and the other the culture of ordinary, rather than aristocratic, Javanese people,” wrote senior editor Endy Bayuni in the Jakarta Post.

Although the military is out of politics, many retired officers build their second career in it. Prabowo naturally attracts quite a few former soldiers, and there are a number on Joko’s side too, including Wiranto, the Hanura Party’s founder who, in 2000, lost his post as Security Minister over alleged involvement in East Timor’s referendum violence.

But no retired officer is more polarizing than Prabowo. His critics see the 62-year-old as part of Suharto’s authoritarian regime — he was married to a daughter of Suharto, joined elite military units and took part in military operations in the separatist provinces of East Timor and Irian Jaya. His quick rise through the ranks was cut short in 1998 after he was discharged from the military because of his alleged role in the abduction of pro-democracy activists in the months before the fall of Suharto.

His Gerindra Party has formed a coalition with three Islamic parties, two of which are known for intolerant views toward religious minorities. Gerindra’s manifesto has also raised alarm. While it guarantees freedom of religion, it also says that “the state is required to guarantee the purity of teachings of the religions acknowledged by the state from all forms of defamation and deviation.” That is likely to spell more trouble to groups like the Shi‘ite and Ahmadi Muslims, who are frequent victims of violence and intolerance.

Although opinion polls show that Prabowo has gained ground, the 52-year-old Joko, nicknamed Jokowi, is the front runner in the presidential race. But even if Prabowo wins the election, some analysts argue that it will be difficult for him to bring back military rule. “Indonesia’s democratic institutions are pretty solid and can’t be overturned by him,” Ulil says, adding that people should be more worried about “the radical forces around him that support his agenda.”

Prabowo himself tries to assuage fears. “I don’t want to lead in an authoritarian manner,” he said on Twitter, responding to a tweet that suggested if the former general became President, he could follow in the footsteps of the Thai junta, which threatened to block social media (and, according to some reports, briefly did so on Wednesday). “Whatever my political rivals say, I support freedom of the press and of expression.”

But many remain skeptical. “The first obstacle that we have to face,” said Fadjroel Rachman, a student activist turned political commentator, “is the return of the danger of fascism.” And if anything, Indonesia should look to Thailand and Egypt to draw the most important lesson of all: democracy should never be something to be taken for granted.

Contact us at letters@time.com.