Indonesia's Joko Widodo was on track to be re-elected leader of the world's third-biggest democracy with pollsters giving him a wide lead over rival Prabowo Subianto, a firebrand ex-general, hours 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 holding a strong lead with around 55 percent of the vote to Subianto's 44 percent.
The vote officially ended at 1:00 pm (0600 GMT) in Sumatra, although some of the 800,000 polling stations across the volcano-dotted nation remained open late due to delays and long queues.
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.
More than 190 million voters were asked to choose between the incumbent Widodo, lauded for his infrastructure driven economic push, and his fiery nationalist rival, who has strong ties to the country's three-decade Suharto dictatorship.
The call to prayer had rang out as voting began at first light in restive Papua province in the east.
Almost 90 percent of the population of the 4,800 kilometre-long (3,000 mile) country are Muslim.
The campaign was punctuated by bitter mudslinging and a slew of fake news online -- much directed at the presidential contenders.
Leading in pre-vote polls, President Joko 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, including a small LGBT community, as Islamic hardliners become more vocal in public life.
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.
Widodo -- a practising Muslim who has battled doubts about his piety -- jetted to Mecca, the birthplace of Islam, for a brief, pre-election pilgrimage Sunday.
Raised in a bamboo shack in a riverside slum, the soft-spoken Widodo stands in stark contrast to Subianto, 67, a strongman who courted Islamic hardliners and promised a boost to military and defence spending.
Echoing US President Donald Trump, Subianto vowed to put "Indonesia first" by reviewing billions of dollars in Chinese investment.
His long-held 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 the world's third-biggest democracy.
He ordered the abduction of democracy activists as the authoritarian regime collapsed in 1998, and was accused of committing atrocities in East Timor.
Subianto -- who has moved to soften his image with an Instagram account featuring his cat Bobby -- has warned he would challenge the results if he lost this year.
He narrowly lost to Widodo in the 2014 polls.
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.
"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."
Thousands of survivors are still living in makeshift tents in the affected region of the island of Sulawesi.
In mountain-ringed Bandung city, flooding didn't stop people from wading through knee-deep water to cast a ballot, or turning up at polling stations on inflated tyre inner tubes.
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."