Image copyright Reuters Image caption Supporters of defeated candidate Prabowo Subianto gathered outside the court ahead of the verdict

Indonesia's top court has upheld Joko Widodo's victory in July's presidential elections, rejecting an appeal against the result by defeated candidate Prabowo Subianto.

The constitutional court unanimously agreed to reject the appeal.

Mr Widodo won the poll by a 6% margin but Mr Subianto claimed widespread electoral fraud.

Hundreds of Mr Subianto's supporters gathered outside the court ahead of the verdict.

Mr Subianto's team said they would accept the ruling of the constitutional court, which is the highest authority in the country.

'A new era'

Mr Subianto is a former army general closely associated with the traditional elite, while Mr Widodo, a former furniture-maker who grew up in a small village, has promised a decisive break with Indonesia's authoritarian past and better social welfare for the poor.

Mr Widodo's win was seen as heralding a new era for Indonesia, whose leaders have generally been drawn from the military and political elite.

Media playback is unsupported on your device Media caption Earlier in the day, there was a stand-off between police and supporters of Mr Subianto

Judges spent several hours reading out the verdict on Thursday.

"The court rejects ... all applications from the applicant [Mr Subianto] by all nine judges," said Constitutional Court Chief Hamdan Zoelva said.

Speaking after the ruling, Mr Subianto's spokesman Tantowi Yayha said his team would accept the court's decision, although they did not believe the ruling was fair.

Mr Subianto's team would work to provide checks and balances against Mr Widodo in parliament, he added.

Mr Widodo said after the court's decision that there was no enmity between him and his rival.

Earlier on Thursday, crowds of Mr Subianto's supporters had breached a barbed wire barrier blocking the road to the court, prompting volleys of tear gas and water cannon from riot police.

A number of people were injured, but reports said the skirmish lasted only a few minutes and the crowd dispersed quickly.