Indonesian President Joko Widodo comfortably won re-election in last month's poll, an official count showed on Tuesday, throwing the spotlight on his opponent Prabowo Subianto who has refused to concede defeat after claiming widespread cheating.
The result released by the General Election Commission (KPU) confirms unofficial counts by private pollsters in the April 17 election, giving Widodo a 55.5% share of votes against 44.5% for retired general Prabowo.
Widodo won more than 85 million votes of a total of 154 million cast in the world's third-largest democracy, though after repeated claims of fraud by the Prabowo campaign an opposition official said it would launch a legal challenge.
"We decided the number two (Prabowo) ticket will lodge a lawsuit with the Constitutional Court," Sufmi Dasco Ahmad, the legal director of Prabowo's campaign team, told reporters.
Earlier, a witness for the team and the leading opposition party refused to sign and validate the official results, announced more than a day earlier than expected, after the agency worked into the early hours of Tuesday.
"We won't give up in the face of this injustice, cheating, lies, and these actions against democracy," said Azis Subekti, the witness.
On Monday, the election agency dismissed claims of systematic cheating, citing a lack of evidence, and independent observers and analysts have said the poll was free and fair.
It was not immediately clear if planned protests by Prabowo's supporters would go ahead, but in a video ahead of the result he had urged supporters to be peaceful.
"I remind you, we must be peaceful in our struggle, we must be free from violence," Prabowo said in the video, which media website Kumparan.com said it received on Tuesday.
In a statement, Hasto Kristiyanto, secretary of Widodo's campaign team, said, "We are grateful for this victory. This is the people's victory."
Financial markets were mixed after the official result, with stocks up 1.2% and the rupiah off 0.1%.
"Whether Mr. Prabowo would accept the decision of KPU would determine the stability of politics this week," Mirae Sekuritas said in a note.
Authorities have tightened security in a bid to choke off any civil unrest and detained dozens of militant Islamists suspected of planning attacks to create mayhem during demonstrations.
Police have rolled out extra barbed wire and readied armoured trucks and water cannons around the election agency.
Some schools in Jakarta have also shut this week and offices allowed staff to work from home.
Prabowo had warned the cheating claims could trigger "people power"-style protests, while the government and police have urged protesters to keep the peace and vowed action against anyone stirring unrest.
National police, who report directly to Widodo, have also held or interrogated at least three leading opposition figures for suspected treason.
Andre Rosiade, a spokesman for the biggest opposition party Gerindra, denied on Twitter reports that Prabowo had been named a suspect in a treason case involving one of his campaign officials.
The losing candidate can lodge a challenge in the constitutional court within three days, otherwise the election panel will officially declare the winner. Prabowo's challenge to his 2014 defeat by Widodo was rejected.
A coalition of parties backing Widodo won more than half the votes in last month's national level legislative election, gaining control of parliament, the official results showed.
The Indonesian Democratic Party of Struggle (PDIP), to which Widodo belongs, got 27 million votes, and remains the largest party. However, Golkar, lost its second rank to Gerindra, which won 17.6 million votes.