(CNN) —  

Indonesian president Joko Widodo has won a second term as leader of the world’s third largest democracy, official results confirmed Tuesday, beating a former general who has claimed widespread ballot-rigging.

Joko – known as Jokowi – won 55.5% of the vote in last month’s general election while his longtime rival Prabowo Subianto took 44.5%, according to the General Elections Commission. Jokowi, 57, outperformed his 67-year-old strongman opponent in 21 of the country’s 34 provinces, according to CNN Indonesia.

The results are in line with the early “quick count” results, which put the charismatic Jokowi on course to win a second five-year term. The results also mean Ma’ruf Amin, an Islamic cleric and Jokowi’s 76-year-old running mate, will become Vice President.

Prabowo plans to challenge the election results by filing a lawsuit with the Constitutional Court, his campaign staffer Sufmi Dasco Ahmad said Tuesday.

Once the election commission finalizes the results Wednesday, Prabowo’s camp has three days to file the lawsuit contesting the outcome. Prabowo, who with 44.5% support won over 68 million votes, had said before the official announcement that he would reject the result, if it went against him.

“We are concerned about the enormous fraud committed in the general elections that we have just carried out,” he said in video footage received Tuesday by CNN Indonesia, urging supporters to stay peaceful and not resort to violence.

There was heavy security and barbed-wire barricades in the capital Jakarta, where Prabowo’s supporters planned to hold a rally Wednesday, the Jakarta Post reported.

The presidential inauguration is expected to be held in October.

Indonesian Presidential candidate Prabowo Subianto shakes hands with voters after casting his vote at a polling station on April 17, 2019 in Babakan Madang, Indonesia.
Indonesian Presidential candidate Prabowo Subianto shakes hands with voters after casting his vote at a polling station on April 17, 2019 in Babakan Madang, Indonesia.
PHOTO: Ed Wray/Getty Images AsiaPac/Getty Images

It’s not the first time Prabowo has gone head-to-head with Jokowi – or the first time that he has indicated he would reject the result of an election.

The two faced off in the 2014 general election, when there was a feeling that democracy itself was at stake. At the time, Prabowo indicated that he would roll back democratic reform, while Jokowi, a child of the slums, was a self-styled man-of-the-people with no links to the military or the country’s traditional elite.

After losing the 2014 election, Prabowo slammed the election commission, citing “massive, structural and systematic cheating,” and said he was withdrawing from the process. The Constitutional Court upheld Widodo’s victory.

Indonesia’s election was billed as one of the most complicated single-day ballots ever undertaken. For the first time, it held its presidential and legislative elections on the same day, with more than 245,000 candidates running for over 20,000 seats.

Some 192.8 million people were eligible to vote across the archipelago’s 17,000 islands, and more than 800,000 polling stations and six million election workers were involved.

Edi Amin and CNN’s Sarah Faidell in Hong Kong contributed to this story.