The Constitutional Court, which took a marathon nine hours to publicly read its reasoning on the case, said the legal team of the losing candidate, former Gen. Prabowo Subianto, had failed to prove allegations that included millions of fake voters and biased state institutions. The court's ruling is final.
Thousands of police and soldiers were deployed to boost security in Jakarta as authorities strove to avoid a repeat of deadly riots last month. Pro-Subianto protesters who had gathered near the court melted away around dusk as the broadcast of proceedings on a TV screen outside indicated their candidate's case was unsuccessful.
The official election results released last month showed Widodo won 55.5% of the vote but also revealed a polarized electorate. Subianto, who allied himself with groups that want Islamic rather than secular law to prevail in the world's largest Muslim-majority nation, won big victories in conservative provinces.
The legal challenge's failure was widely expected after documents filed with the court showed that much of the evidence for the alleged fraud in the April 17 election was printouts of tangentially related news articles from online sites of varying quality.
The evidence purporting to show police bias in favor of Widodo included allegations from an anonymous Twitter account. The hearings were broadcast on national TV and showed the testimony of some witnesses disintegrating under questioning from the panel of judges.
Widodo, the first Indonesian president from outside the Jakarta elite, said Indonesians should reunite after a divisive election campaign. "In the election our political choices are different but the elected president and vice president are the president and vice president for all children of the nation, for all Indonesians," he said.
HIs administration, however, has increasingly flirted with authoritarianism, using a draconian presidential decree to ban an Islamic group that promoted Indonesia becoming a caliphate and allowing authorities to arrest opponents under an easily abused hate speech law.
The legal challenge appeared to be partly an attempt to strengthen the hand of Subianto's party, Gerindra, which has been negotiating with Widodo's governing coalition for Cabinet positions. Minutes after the ruling, Subianto said he had "respect" for it, reducing the risk of more violent protests but also raising the possibility of his party joining Widodo's government and leaving the world's third-largest democracy without a significant parliamentary opposition.
"The ruling is very disappointing for us and our supporters, but we have committed to obey the constitution and we respect the Constitutional Court's decision," he said. Subianto, linked to human rights abuses during the authoritarian rule of Suharto, also unsuccessfully challenged his presidential election loss to Widodo in 2014 and has now made four unsuccessful bids for the presidency.
Nine people died in what police said were orchestrated riots in Jakarta after the official results were released May 21. Amnesty International has said police used disproportionate force against protesters that resulted in unlawful killings and other human rights violations.