Indonesia election: President Joko Widodo wins second term as opposition vows to contest results

Indonesia’s president Joko Widodo has been re-elected for a second term, official results confirmed, as his strongman, ultra-nationalist opponent said he would launch a legal challenge in the courts.

Final results gave Mr Widodo 55 per cent of the vote compared to the 45.5 per. cent of his challenger, the former General Prabowo Subianto, roughly in line with an early count that was released shortly after the close of voting in the 17 April election.

Those initial results had prompted Mr Subianto to threaten to mobilise “people power” on the streets if he was denied the victory that he claimed was subverted by cheating in the poll.

Thousands of soldiers and police were deployed on high alert as the final results were confirmed - but in the end the general told reporters he would pursue “legal efforts in line with the constitution to defend the mandate of the people”.

In a video released after results were announced Tuesday, Mr Subianto refused to concede defeat but called on supporters to refrain from violence.

Mr Widodo, a progressive leader whose first election was seen as breaking the hold on power of Indonesia’s political and military elite, said he “appreciated” his rival’s decision to follow “a process in accordance with the constitution and the law”.

The incumbent’s campaign highlighted his progress in poverty reduction and improving Indonesia's inadequate infrastructure with new ports, toll roads, airports and mass rapid transit.

Mr Subianto, on the other hand, ran a fear-based campaign that focused on what he saw as Indonesia's weakness and the risk of exploitation by foreign powers - particularly China - or disintegration.

Subianto campaign official Sufmi Dasco Ahmad said a legal challenge to the results would be filed in the Constitutional Court within the mandatory three days.

Mr Subianto, who also lost to Mr Widodo in 2014 and unsuccessfully contested that result, has alleged massive election fraud in the world's third-largest democracy but hasn't provided any credible evidence.

Votes are counted publicly and the commission posts the tabulation form from each polling station on its website, allowing for independent verification.

The Election Commission said Mr Widodo won in 21 of 34 provinces and got 85.6 million votes compared with about 68.5 million for Mr Subianto.