Indonesian ex-general Prabowo Subianto angrily claimed widespread cheating cost him victory in the country's presidential election at the start of legal challenge to the results Wednesday, as hundreds of flag-waving supporters staged a rally.

In a fiery speech at the Constitutional Court, Prabowo lashed out at the "dishonesty and injustice" of the poll -- which he lost to Joko Widodo -- and compared politics in the world's third-biggest democracy to Stalinist North Korea.

Widodo, a former furniture exporter known by his nickname Jokowi, won legions of fans with his down-to-earth style as Jakarta governor and is the country's first leader from outside the political and military elites.

Prabowo, a controversial former military figure with roots in the era of dictator Suharto, also declared victory at the July 9 presidential election, but official results two weeks later confirmed Widodo won a decisive victory.

However, the ex-general -- who has been seeking the presidency for a decade -- has still refused to accept the results.

His team has filed a lengthy complaint against the election commission with the Constitutional Court in the capital Jakarta, which rules on poll disputes.

They claim he is the true winner of the election, that fraud occurred at tens of thousands of polling stations, and that election officials failed to order recounts in numerous places where they should have.

While the challenge is widely expected to fail, it has nevertheless dragged out the lengthy election process for a few more weeks. The court must issue a ruling by August 21, which cannot be appealed.

'Like North Korea'

At Wednesday's preliminary hearing, Prabowo delivered a typically fierce speech, saying his side had "tens of thousands" of witnesses who could back up his claims.

He said the election had been hit by "distortion, dishonesty and injustice".

"There are hundreds of polling stations where our coalition... received zero votes. This could only happen in a totalitarian country like North Korea," he said.

While there were some instances of vote fraud during the election, most analysts consider the country's third direct presidential election since the end of authoritarian rule in 1998 to have been free and fair.

Prabowo said he was seeking "justice for the Indonesian people".

"If justice cannot be served, we are very, very worried for the future of Indonesia's democracy, Indonesia's people," he added.

Outside the court, hundreds of supporters waved flags emblazoned with pictures of Prabowo, as speakers denounced the election result and claimed the ex-general was the true winner.

"We have been treated unfairly so it is our right to get angry," one speaker told the crowd.

Security was tight, with hundreds of riot police guarding the court and water cannons on standby in case the situation got out of hand.

Wednesday's hearing lasted only a few hours and ended with the nine-judge panel ordering Prabowo's team to revise their documents and resubmit them the following day.

They cited inconsistencies between what his lawyers said in court and evidence presented in the documents. The next hearing was set for Friday.

Independent analysts view Prabowo's challenge as unlikely to succeed.

While the presidential election was the closest since three decades of authoritarian rule came to an end, Widodo still won by a margin of six percentage points, or more than eight million votes.

The court has never moved such a large chunk of votes from one candidate to another and observers don't expect it to do so this time, or to order a full recount of the vote.

There have been concerns about the court's impartiality after its former chief justice was jailed for life in June for accepting bribes to influence rulings on regional election disputes.

But the heightened public scrutiny of the court is expected to mean that the institution will be at pains to appear squeaky clean.