Jakarta Governor Joko Widodo, best known as Jokowi, has won the race to become the next president of Indonesia. His rival Prabowo Subianto has refused to concede, however, setting up a showdown over the results that could last until late August.

We know Jokowi won because a collection of established polling firms, respected for their accuracy, released what are known as 'quick counts' yesterday afternoon. Quick counts are not exit polls, but neither are they official results. Quick counts are conducted by sending observers out to a representative sample of polling places to witness the initial tabulation of votes cast at each polling station. Polls in Indonesia closed at 1pm yesterday, and poll workers at each station immediately set about counting each vote in broad daylight and full public view so that voters could check the results with their own eyes against the final tally. The quick counts are based on observation of those initial counts, and have historically been accurate to within 1% of the official result.

The five most established organisations fielding quick counts — the Centre for Strategic and International Studies, Saiful Mujani Research and Consulting, Indikator, Kompas, and Radio Republik Indonesia — showed a Jokowi margin of victory of between 3.8% and 5.9%. A handful of less established firms, some of which are affiliated with Prabowo supporters, put out polls showing a Prabowo victory at widely varying margins.

The General Election Commission (KPU) will now conduct several further counts at the district, provincial, and finally national level. Under the elections law, it is due to release its final tally on either 21 or 22 July. Later that week, challenges to the official result can be filed with the Constitutional Court, which will hear those challenges in August and rule on them between 22-24 August.

Prabowo has every right to await the official count by the KPU and to challenge the result in the Constitutional Court. We should remember that the chair of Jokowi's party, former President Megawati Sukarnoputri, did just that in 2009 when her opponent's margin of victory was a much higher 34%. I cannot forsee any scenario in which Prabowo would not exhaust every legal avenue available to challenge the result. He has come too far and invested too much time and money to not do so. Assuming he takes this as far as he can, the KPU and Constitutional Court would not be able to declare Jokowi the winner of the election until late August.

In a speech to supporters on Wednesday night, Prabowo told them to 'have patience, follow the law, and try to be polite.' But Jokowi supporters expressed grave concern that Prabowo might use his muscle to disrupt or taint the vote counting. Prabowo has cultivated ties with underworld figures as well as nationalist and Islamist thugs. He can also call on considerable reserves of cash — he disclosed $140 million in assets to the election commission earlier this month — and neither the KPU nor the Constitutional Court have avoided Indonesia's unfortunate history of graft. In just the past year, the former chief justice of the Constitutional Court was caught selling rulings in electoral cases. The KPU's computer system is also thought to be vulnerable to tampering. These are serious concerns in Indonesia's young democracy.

Given Prabowo's mercurial reputation, we cannot rule out the possibility of political turmoil in the coming weeks. Yet even as Indonesians prepare to closely monitor vote tabulations and electoral challenges, many told me that there was a feeling in Jakarta last night that the country had turned a new page. Despite warnings from the authorities to stay home in order to avoid clashes, hundreds turned up to witness Jokowi declare victory at the Proclamation Monument just before sunset, and continued on to break the fast and celebrate into the evening in the city's iconic Hotel Indonesia traffic circle. Perhaps, as CSIS researcher Evan Laksmana suggested from Jakarta, the 'outpouring of public support and celebration of Jokowi' would discourage anyone from attempting to subvert the result.