Indonesia pulled off a complex yet peaceful election across its vast - and ethnically diverse - island territory this week, cementing its place as a democratic beacon in a sea of authoritarian governments, analysts say.
But the world's biggest Muslim-majority nation still faces a spike in militant Islam and myriad other challenges.
On Wednesday, the sprawling Southeast Asian archipelago saw as many as 190 million voters cast ballots to elect a new president, parliamentarians and local legislators, in a one-day contest with a record 245,000 candidates.
Preliminary results appeared to hand a second term to President Joko Widodo, but he held off declaring victory pending official results next month.
However, his rival ex-general Prabowo Subianto - who has strong ties to the Suharto dictatorship that collapsed in 1998 - insisted he won, and vowed to challenge the results.
He did the same, unsuccessfully, after losing to Widodo in 2014 and there is little to suggest Subianto will win this latest fight.
Despite the lingering uncertainty, Indonesia's democratic feat still stands in stark contrast to strongman governments in the Philippines and Cambodia, authoritarian Vietnam and Laos, Myanmar's stumbling post-junta steps and a chaotic election in Thailand, its first since a 2014 coup.
"In a region that is not inclined towards democracy, where authoritarianism is on the rise, Indonesia's democracy really has weight - even if it is turning more conservative," said Christine Cabasset at the Bangkok-based Research Institute on Contemporary Southeast Asia.
In a nod to voter participation, one reputable pollster recorded 82 percent turnout in this week's polls, the highest since 2004 legislative elections, local media reported.
"People are voting and making a difference. Indonesians have embraced their own electoral power, especially younger voters," said Bridget Welsh, a Southeast Asia expert at John Cabot University in Rome.
"This bodes well for greater demands for better governance," she added.
Still, Welsh was sharply critical of Widodo's rights records, and there are doubts about whether the 57-year-old will use his political capital to safeguard two decades of democratic progress that some fear is being undermined.
"My prediction over the next five years is that we will continue to see a slow erosion of democratic quality," said Marcus Mietzner, an associate professor at the Australian National University.
"(But) not a full push into authoritarianism," he added.
Widodo himself has been accused of creeping authoritarianism following arrests of opposition campaigners under a controversial electronic defamation law, while a decree during his tenure allowed Jakarta to ban mass organisations.
Others have raised concerns about the renewed influence of the military, which is eyeing more civilian government positions in the country of 260 million - home to hundreds of ethnic groups and languages.
Indonesia's reputation for religious tolerance has also been tested by increasingly vocal hardline Islamists, who were emboldened after their calls to prosecute Jakarta's Christian governor for blasphemy saw him jailed in 2017.
A years-long struggle with extremism was underlined last year by suicide bombings at several churches in its second-biggest city Surabaya - amid a growing gulf in society between moderate and hardline Muslims.
"Both candidates exploited Islam as campaign issues," said Made Supriatma, a visiting fellow at Singapore-based think tank Yusof Ishak Institute.
"This religious war surely will have some effects in political debates in Indonesia in the years to come."
Widodo's choice of conservative cleric Ma'ruf Amin as his running mate - in part to neutralise attacks on his own religious credentials - has stirred fears about how minorities will fare over the next five years.
Gay and transgender people have been subject to abuse and arrest, while a Christian woman was jailed for blasphemy after complaining about the volume of a mosque's loudspeaker.
"Military sector reform is a must, so is the protection of minorities and tackling intolerance and extremists," said Yohanes Sulaiman, a political analyst at the Universitas Jenderal Achmad Yani.
Some also see traces of Indonesia's long collapsed dictatorship in the current, corruption-riddled system.
"It is hard to root out," said Supriatma.
"All political parties are dominated by old players, both nationally and regionally."
But there is little appetite for anything but another smooth power transition.
"Indonesian democracy is still a work in progress," said Dewi Fortuna Anwar, a research professor at the Indonesian Institute of Sciences.
"But the fact you do not go to the streets and bring your guns if you want to dispute a vote, rather you go through a court process - that is very much part of Indonesian democracy."