Indonesian President Joko Widodo has declared victory in Wednesday’s election, even as his challenger continues to contest the result.
Former general Prabowo Subianto claimed he had won and that his camp had evidence of “widespread cheating”.
Official results will not be out until May but “quick counts” by polling companies have given Mr Widodo a lead of about 10 percentage points.
Authorities have appealed for calm and vowed to tackle any unrest.
“If there are any illegal or unconstitutional actions that threaten public stability and security, [the authorities] will take firm action,” said National Police Chief Tito Karnavian.
Wednesday’s election in the world’s third-largest democracy followed a bitter campaign in which religion played a key role.
Indonesia, a vast archipelago, is home to the world’s largest Muslim population and has more than 260 million people.
More than 192 million were eligible to cast their ballot to select 20,000 local and national lawmakers, including the president.
On Thursday, Mr Widodo told a press conference that he had won the vote with 54.5% – based on counts by 12 pollsters. Leaders from more than 20 countries had already called to congratulate him, he said.
Mr Widodo also said the quick counts of sample votes were highly accurate and that the country should “patiently wait” for official results.
Minutes later, Mr Prabowo told reporters his camp was declaring victory because it had “evidence of widespread cheating at the village, sub-district and district levels across Indonesia”. He said he had won with 62% of the vote.
At the last election in 2014, Mr Prabowo also challenged results, alleged widespread fraud and declared victory after losing to Mr Widodo. The Constitutional Court upheld the result after rejecting his legal challenge.
Indonesian stocks surged on Thursday morning as investors reacted to the expectation that Mr Widodo had won a second five-year term.
Why was this election unique?
This was the first time the country’s presidential, parliamentary and regional elections all took place on the same day, with more than 245,000 candidates in the running for various seats.
If that was not hard enough to co-ordinate, things were further complicated by the geography of Indonesia – an archipelago of more than 17,000 islands.
Voters – including those in remote and far-flung parts of the country – had a window of only six hours to cast their ballots at one of the country’s 810,000 polling stations.
Who are the contenders?
Mr Widodo, 57, comes from humble beginnings – he is a former furniture salesman – and has focused past campaigns around his “man of the people” image.
Under his leadership the economy has grown steadily, but he has disappointed some supporters by abandoning campaign promises to resolve human rights violations. He has courted massive Chinese infrastructure investment.
Meanwhile Mr Prabowo, 67, is closely associated with the traditional political elite.
He was previously married to the daughter of former dictator Gen Suharto, who ruled Indonesia with an iron fist for 30 years. Mr Prabowo stands accused of complicity in human rights abuses committed under Gen Suharto, but has maintained his innocence.
Despite his background, during the campaign he sought to distance himself from the political class and railed against the “evil elites in Jakarta”. He promised to review all Chinese investment projects in Indonesia.
What were the main issues?
As ever, infrastructure, corruption and the economy were all on voters’ minds. But Indonesia’s national identity of “unity in diversity” was also seen to be at stake.
Though 80% of the country is Muslim, Indonesia has no official state religion and the right to practise other faiths is enshrined in the constitution.
But in recent years, Indonesia has seen conservative religious groups grow increasingly vocal. In 2016, Jakarta’s Chinese-Christian governor Basuki Tjahaja Purnama – known as Ahok – was accused by hardliners of blasphemy against Islam.
After mass rallies in the streets, he was imprisoned for two years.
Analysts say the presidential candidates sought to tout their Islamic credentials during the campaign.
Mr Widodo, a religious moderate, picked powerful cleric Ma’ruf Amin as his running mate, while Mr Prabowo promised to protect Islamic leaders and increase funding for religious schools.