Indonesia's Joko Widodo was on track to be re-elected leader of the world's third-biggest democracy as unofficial results put him in a comfortable lead over firebrand ex-general Prabowo Subianto after voting closed Wednesday across the 17,000-island archipelago.
While official results are not due until next month, a series of so-called "quick counts" by pollsters showed Widodo as much as 11 percentage points ahead.
The vote ended at 1:00 pm (0600 GMT), but some of the 800,000 polling stations across the volcano-dotted nation remained open late due to delays and long queues.
The quick counts have been reliable indicators in past elections, but Widodo held off declaring victory – while his rival insisted he had won.
"We've all seen exit poll and quick count numbers, but we still need to wait for the official results," Widodo told cheering supporters in Jakarta.
The 67-year-old Subianto – who warned of street protests and legal challenges if he lost – insisted that he was Indonesia's next leader, without citing specific evidence.
"We will not use illegal tactics because we have won," Subianto said.
"For those who defended (my rivals), I'm still going to defend you. I'm the president of all Indonesians," he added.
Subianto, who has long had his eye on the country's top job, lost to Widodo in 2014 and then mounted an unsuccessful legal challenge to the election.
This year's campaign was punctuated by bitter mudslinging and a slew of fake news online – much of it directed at the presidential contenders.
"I hope after this that there will be a call for reconciliation because...we've been living in a very polarised atmosphere," political analyst Gun Gun Heryanto told Kompas TV.
Papua to Sumatra
From the jungles of Borneo to the slums of Jakarta, Wednesday saw millions of Indonesians cast their ballots in one of the world's biggest exercises in democracy.
Horses, elephants, motorbikes, boats and planes were pressed into service to get ballot boxes out across the vast country that is home to hundreds of ethnic groups and languages.
The call to prayer had rang out as voting began at first light in restive Papua province in the east of the 4,800 kilometre-long (3,000 mile) Muslim majority nation.
Leading in pre-vote polls, Widodo, 57, pointed to his ambitious drive to build much-needed roads, airports and other infrastructure across Southeast Asia's largest economy.
But Widodo – a political outsider with an everyman personality when he swept to victory in 2014 –has seen his rights record criticised owing to an uptick in discriminatory attacks on religious and other minorities.
His choice of conservative cleric Ma'ruf Amin as his running mate also raised fears about the future of Indonesia's reputation for moderate Islam.
The soft-spoken Widodo stood in stark contrast to fiery nationalist rival Subianto, a strongman who courted Islamic hardliners and promised a boost to military and defence spending.
Echoing United States (US) President Donald Trump, Subianto vowed to put "Indonesia first" by reviewing billions of dollars in Chinese investment.
His presidential ambitions, however, have been dogged by a chequered past and strong ties to the Suharto dictatorship, which collapsed two decades ago and opened the door for what is now a flourishing democracy.
Subianto – who moved to soften his strongman image with an Instagram account featuring his cat Bobby – ordered the abduction of democracy activists as the authoritarian regime collapsed in 1998, and was accused of committing atrocities in East Timor.
A record 245,000 candidates ran for public office, from the presidency and parliamentary seats to local positions – the first time all were held on the same day.
Voters punched holes in ballots – to make clear their candidate choice – and then dipped a finger in Muslim-approved halal ink, to prevent double-voting in a graft-riddled country where ballot-buying is rife.
In Palu, which was devastated by a quake-tsunami six months ago, one woman who lost her 10-year-old daughter and her home in the disaster voiced hope that the poll could help bring some relief to thousands still living in makeshift tents.
"Hopefully the president or the new legislative candidate will help people like us still living in evacuation shelters," said Laila, who like many Indonesians goes by one name.
"All this time we've been living on handouts from volunteers."
'Path of our nation'
About two million military and civil protection force members were deployed to ensure the vote went smoothly, including in mountainous Papua where rebels have been fighting for decades to split from Indonesia.
Papua election officials dressed in traditional headgear and grass skirts, as others strapped on superhero costumes to entertain voters in other parts of the country of 260 million.
"This only happens once in five years, so we have to exercise our (voting) rights," I Gusti Ketut Sudarsa, 65, said from holiday hotspot Bali.
"This will determine the path of our nation." - AFP