On Friday 1 September, Kenya’s Supreme Court delivered a surprise. Against the expectations of many, the court ruled - in a 4:2 majority verdict - that the presidential election held on 8 August was null and void.

The incumbent president, Uhuru Kenyatta, had been declared the winner of that poll. He will now have to face Raila Odinga, the runner-up and leader of the main opposition coalition in a new election, which must be held before October 31.

Such judicial boldness would be unusual anywhere. In Kenya, where the powerful have often flouted the law with impunity, it is remarkable. The decision was all the more unexpected because the opposition had been given little time to gather evidence of the irregularities which they alleged had plagued the election.

Odinga welcomed the decision, which has also been applauded by others. The opposition had initially been reluctant to take their grievances to court, for they did not believe the court would rule against the incumbent.

For decades, power in Kenya has lain with the government, and with the administrative organisations that serve it. This single decision suggests that may have changed. Finally, one of the intentions of Kenya’s 2010 constitution – to ensure a robust and independent judiciary – seems closer to realisation.

Different sets of figures

In 2013, a similarly hastily assembled opposition petition against Uhuru’s previous election victory was dismissed. That outcome was expected again, especially as this year’s elections had initially been praised as a success. New biometric technology worked well across the country, and international observers praised the smoothness of the day’s voting.

But within hours of the polls closing, the opposition alleged that the electronic transmission of results from polling stations was being rigged. Scanned copies of paper forms from polling stations were supposed to be transmitted and made available on a public website to confirm the results. But forms came in slowly, and some were simply unavailable.

The number of rejected votes, surprisingly high on the website, was much lower in the declared results. The opposition claimed they had received the “real” results from an IEBC insider, and that Odinga had won. They released two separate versions of these alternative results, so that four different sets of figures were in circulation, two provided by the IEBC and two by the opposition.

In petitioning the court, the opposition claimed that an algorithm in the results system kept Kenyatta ahead, whatever numbers were fed in. They pointed to some anomalies in the paper records of results. In a few polling stations, Odinga’s votes had been reduced. One tally sheet wildly inflated the number of voters in a particular constituency, adding thousands of votes to Kenyatta’s total.

Many of the paper copies of forms were not properly stamped or signed. Some seemed to be photocopies, and variations in format raised doubts over the authenticity of some documents. Against this evidence, lawyers opposing the petition argued that the total number of votes that were shown to have been changed was small – much smaller than Kenyatta’s declared margin of victory. They said that even if there were mistakes in the process, these had not changed the overall outcome.

The dissenting minority of judges seem to have agreed. But the majority evidently followed a different reasoning – though their full judgment has not yet been released.

The court’s decision

The brief statement of their decision emphasised the importance of upholding the constitution and the law. It held that the law around the transmission of results had not been followed.

The judges made no mention of the alleged algorithm, and they explicitly found no wrongdoing on Kenyatta’s part. Nor did they offer an opinion as to whether what they called “irregularities and illegalities” changed the outcome - perhaps because they saw that as irrelevant.

Their implied logic is straightforward: the law was not strictly followed, so the election was invalid.

In any event, IEBC staff will be under intense pressure. What if procedural flaws in the rerun render that election, too, invalid? Their morale may be further dented by the prospect of having to manage multiple by-elections. That’s because the court decision may well trigger a spate of successful petitions over the elections to other positions that were also held on 8 August.

Kenyatta has expressed confidence that he will win the new election. But Odinga’s support might be buoyed by this court victory, which somehow makes change seem more possible. If the full judgment, when it comes, upholds the opposition allegation that Kenyatta’s campaign misused state resources, that might also reduce the advantages enjoyed by the incumbent.

On the other hand, Kenyatta may have a new campaign theme. Speaking to supporters after the judgment, he reportedly characterised the judges as “know-alls” who had gone against the will of the voters and said he would “deal with” them once the election was over.

The press have denounced these remarks as intimidation. But in Kenya, reverence for formal education is uneasily interwoven with a resentment of the presumptions of the educated.

Popular mistrust of an educated elite has recently shown itself to be a powerful force elsewhere in the world. In Kenya, the primacy of the law has been asserted - but the final outcome of this contest is unpredictable.