Kenya's Supreme Court on Friday nullified President Uhuru Kenyatta's election win citing irregularities and ordered a new poll within 60 days, a rare move in Africa where judicial power is often seen as an extension of government.
The ruling, broadcast to a stunned nation on national television, sets up a new race for the presidency between Kenyatta, 55, and veteran opponent Raila Odinga, 72.
Kenyatta called for calm and respect for the ruling, while Odinga's cheering supporters paraded in the streets of his western Kenyan heartland. Last month's election results sparked protests and sporadic violence that killed at least 28 people.
Kenya, a US ally in the fight against Islamists and a trade gateway to East Africa, has a history of disputed votes.
A row over the 2007 poll, which Odinga challenged after being declared loser, was followed by weeks of ethnic bloodshed that killed more than 1,200 people. Kenya's economy, the biggest in the region, slid into recession and neighbouring economies wobbled.
Judge David Maraga announced the Supreme Court's verdict that was backed by four of the six judges, saying the declaration of Kenyatta's victory was "invalid, null and void". Details of the ruling will be released within 21 days.
In the court room, a grinning Odinga pumped his fist in the air. Outside, shares plummeted on the Nairobi bourse amid the uncertainty, while Kenyatta's supporters grumbled. But there was no sign of frustrations spilling over into anger on the streets.
The judge said the election board "failed, neglected or refused to conduct the presidential election in a manner consistent with the dictates of the constitution."
Kenya's judiciary went through sweeping changes after 2007 election violence, on a continent where many Africans complain of judiciaries that rubber stamp government or presidential decisions.
"The court has made its decision. We respect it. We don’t agree with it. And again, I say peace," Kenyatta told the nation in a televised address. "That is the nature of democracy."
Official results had given Kenyatta 54.3 percent of the vote, compared to Odinga's 44.7 percent, a lead of 1.4 million votes. Kenyatta's ruling party also swept the legislature.
"For the first time in history of African democratisation a ruling has been made by a court nullifying irregular elections for the president," Odinga said, adding that members of the election board "belong in jail" for their conduct.
An election board official said there would be personnel changes, but it was not clear if that would be enough for the opposition. Sweeping out the whole board would complicate efforts to hold a new poll within two months.
International observers had said they saw no sign of manipulation of voting and tallying at polling stations.
But the election board was slow posting forms showing polling station results online. Thousands were missing when official results were declared, so opponents could not check totals. Court experts said some documents lacked official stamps or had figures that did not match official tallies.
"It’s historic and it could potentially be a moment that consolidates Kenya's democratic credentials," said Crisis Group analyst Murithi Mutiga, adding that the fate of the election board could "trigger a crisis" if there was no consensus.
In a nation of more than 40 ethnic groups, tribal loyalties often trump policy at election time. Kenyatta's Kikuyu is the biggest of Kenya's tribes but still a minority. Odinga is a Luo.
Many voters in the west of Kenya, Odinga's stronghold, and on the coast, where many of the nation's Muslims live and traditionally another region of opposition support, feel neglected by central government.
Kenyatta, whose Kikuyu tribe has produced three out of Kenya's four presidents, has his main support base in the central region.
Kenyatta and Odinga are both scions of political families. Kenyatta's father, Jomo Kenyatta, was the nation's founding president who had a long-running rivalry with Oginga Odinga, who failed like his son in efforts to secure the top job.
Odinga has contested the last three elections and lost each time. After each one, he has claimed the votes were marred by rigging. In 2013, the Supreme Court dismissed his petition.
This time, his team focused on proving the process for tallying and transmitting results was flawed, rather than proving how much of the vote was rigged.
Residents in the western city of Kisumu, where Odinga has strong backing, cheered and motorcycle drivers hooted their horns. "Today is a special today and I will celebrate until I am worn out,” said 32-year-old Kevin Ouma.
In the eastern Rift Valley town of Kinangop, a stronghold for the ruling party, small groups gathered and complained.
"Over 8 million people supported the election of Uhuru Kenyatta but the Supreme Court has ignored this in the ruling which is very shameful," said Matheri Wa Hungu.
Kenyan shares, which rallied after Kenyatta was declared winner, tumbled on Friday and prompted the authorities to suspend trading for half an hour. The shilling weakened and Kenya's dollar bonds fell.