Kenya's Supreme Court on Friday ordered a new presidential election within 60 days, after a shock ruling canceling the results of last month's poll over widespread irregularities.
Chief Justice David Maraga said a majority decision by the panel of six judges, with two dissenting, found that President Uhuru Kenyatta "was not validly elected," rendering the result "invalid, null and void."
Supporters of veteran opposition leader Raila Odinga's wept and cheered, utterly stunned at what they saw as a historic justice rendered after losses in successive polls they believe were rigged, from a judiciary long seen as compromised in favor of the ruling elite.
Odinga, 72, hailed a "historic" ruling which he said was a first in Africa.
Maraga said the election commission (IEBC) had "failed, neglected or refused to conduct the presidential election in a manner consistent with the dictates of the constitution."
Kenyatta accepted the court's decision, and urged Kenyans to remain peaceful.
"Millions of Kenyans made their choice but six people have decided that they will go against the will of the people," he said.
"I personally disagree with the ruling that has been made today but I respect it."
Kenya has a long history of disputed votes, election violence and a lack of faith in the judiciary's independence.
"It was a surprise because the trend in justice in Kenya is not good, but this time justice has been done," said 39-year-old accountancy student Donna Abongo.
"Kudos to the judges!"
"For the first time we have got justice. They have stolen elections for so long," said fishmonger Lynette Akello in western Kisumu.
The run-up to the Aug. 8 election was marred by the murder of top election commission IT official Chris Msando and opposition allegations that rigging was certain.
Indeed Odinga and his National Super Alliance cried foul shortly after counting began, claiming the system transmitting votes had been hacked, and that forms from polling stations that were meant to back up the electronic results were not being uploaded.
The Aug. 11 declaration of Kenyatta's victory with 54.27 percent of the vote — with not all the tallying forms in — sparked two days of demonstrations and riots in the slums of Nairobi and Kisumu, traditional opposition strongholds.
At least 21 people, including a baby and a 9-year-old girl, were killed, mostly by police, according to an AFP tally.
It was the third time in a row that Odinga cried foul, having claimed he was cheated out of rightful victory in 2007 and 2013.
However, the protests remained isolated and did not reach the levels of the disputed 2007 election which saw politically motivated ethnic violence in which over 1,100 people were killed.
In 2013, Odinga took his grievances to court and lost.
This time he initially refused to take the case to court but changed his mind, saying the National Super Alliance wanted the truth to come out even if they believed they had no hope of winning.
However, in a dramatic and unexpected turn of events, the Supreme Court agreed with the opposition coalition.
Maraga said there had been "irregularities and illegalities," notably in the transmission of election results.
He said this had compromised the "integrity of the entire presidential election".
The court's full ruling must be available within 21 days.
Odinga said he no longer had faith in the current election commission and called for them to step down.
Election commission chairman Wafula Chebukati refused to resign, saying he had not been implicated in any wrongdoing personally, but vowed "internal changes to our personnel".
He called for those guilty of wrongdoing to be prosecuted.
National Super Alliance official and lawyer, James Orengo, had argued that irregularities — including unsigned and fake tally forms, hacked servers and deliberate miscounting — had affected around one-third of the 15.5 million votes cast.
But lawyers for the election commission and Kenyatta countered that errors were simply "clerical" mistakes and technicalities that did not affect the outcome of the vote.
A report filed by the court registrar found a number of errors in the 41,451 polling station tally sheets — known as form 34A — as well as in 291 of the form 34B constituency tally sheets, some of which were unsigned, not stamped, illegible or lacking serial numbers or watermarks.
In addition, the registrar's report found that the electoral commission failed to provide full court-ordered access to its servers, which the alliance had demanded in order to back up its allegations of hacking.
Sign up for The Top of the World, delivered to your inbox every weekday morning.