Democracy is a marathon, and Kenya just delivered one of the most decisive victories for African democracy in recent history. Marathons are, after all, our thing.

In a 4-2 decision, the Supreme Court determined that the recently concluded presidential election "was not conducted in accordance with the Constitution and … is invalid".

In practical terms, this means that Kenyans will have a second presidential election within the next 60 days - expensive in terms of money and time, but worth it for a clear and decisive declaration that democracy in Kenya is maturing.

The August 8 vote was a deeply flawed election. Yet weighty assumptions at home and abroad about how democracy is supposed to work in Africa prevented many from seeing that.

Critics were accused of being spoilers or "perennial losers". If they pointed out one of the many problems of the electoral process, they were labelled "tribalists", or overly demanding. Apparently, African citizens should be happy about "good enough" elections and shouldn't demand more. The public was told that credible elections are simply not for this part of the world. The eyes watching Kenya's election were so focused on the prospect of violence that they were prepared to force a clearly problematic process onto Kenyans.

The ruling of the Supreme Court exposes how faulty this minimalist logic is. It underscores that what the elections commission, international observers and some international press wanted to write off as "irregularities" were actually significant procedural failures that undermined the core of Kenyan democracy.

The discontent and criticism of the election were never about Raila Odinga losing it as some have alleged - it was about having a winner who was worthy of the title "democratically elected". And the Supreme Court found that the Independent Elections and Boundaries Commission (IEBC) simply did not deliver on basic democratic principles of transparency and rule of law that should guide any election.

With this ruling, the court has vindicated advocates for credibility, arguing that Kenyans deserved free, fair and credible - not just "good enough" - elections.

With this ruling, the court has vindicated advocates for credibility, arguing that Kenyans deserved free, fair and credible - not just "good enough" - elections.

The court has 21 days to deliver a detailed ruling, but it seems one of the main problems with the election was IEBC's ignoring many aspects of the Constitution and electoral law. Fundamentally, this ruling was about reminding the IEBC that it cannot pick and choose which parts of the constitution to obey.

In court, lawyers for the IEBC struggled to give good reasons about why the core tools of electoral management dictated by law and publicly promised to voters were not actually used during the election. For example, IEBC lawyers shockingly argued that the tallying website public.iebc.or.ke on which local and international reporting about the election relied was "not the public portal" that the IEBC promised, and they never told the court what that website was and why it existed.

The ruling was also about glaring errors that, on one hand, the IEBC argued were not enough to alter the outcome of the election, but on the other, critics argued, compromised the integrity of the whole system. For example, the IEBC conceded that they did not use the electronic transmission system they were required to, and instead relied on text messages and photographs of manually filled forms as sources of information.

The process of tallying was also problematic because the IEBC seemed to ignore much of the law regulating it. The commission lawyers argued that the forms used for reporting results from the different regions were all available in time for the announcement of the results on August 11. Yet as late as August 14, the IEBC was still asking the opposition to "be patient" while it tries to make the forms available to them for verification. How was the final result generated on the basis of forms that were not available until several days after the election?

A number of the forms provided by the IEBC also didn't have serial numbers or bar codes, and some were simple lined paper with numbers scrawled on them. Lawyers for the IEBC conceded these irregularities but argued they were too small to have affected the whole outcome. But in court, the chief justice pushed back: "If some of the forms have bar codes, then shouldn't all of the forms have bar codes?"

After all, this was one of the most expensive elections in the world. Almost $500 million or $28 per capita in taxpayer money was spent on the premise that the process would be brought closer to perfection. Wasn't the money enough to get barcodes?

But beyond establishing high democratic standards for elections in Kenya, this ruling was also about reaffirming judicial independence. It put Chief Justice David Maraga in history books as the first African chief justice to oversee the annulment of election results.

Less than a year into his term, there were already strong indications during a testy pre-election period that judicial independence was of utmost importance to the Maraga-led court. At least three times in under 12 months, the chief justice and the judicial service commission issued statements defending the independence of the judiciary after attacks from the president and the National Assembly majority leader.

All in all, the September 1 ruling was good news for Kenyan democracy. "The greatness of a nation relies on its fidelity to the Constitution and adherence to the rule of law", said Chief Justice Maraga, giving Kenya's democracy marathon a second wind, a massive victory that hopefully translates into a better process and stronger democracy in Kenya and beyond.

Nanjala Nyabola is a Kenyan writer and political analyst based in Nairobi, Kenya.

The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.