Kenya's Supreme Court has annulled the result of last month's presidential election and ordered a new one within 60 days.
The ruling, citing irregularities, makes Kenya the first African country to invalidate an election.
The election commission had declared incumbent President Uhuru Kenyatta the winner by a margin of 1.4m votes.
But the opposition argued that the commission's IT system had been hacked to manipulate the results.
After the ruling was announced, opposition presidential candidate Raila Odinga said: "This is a historic day for the people of Kenya and by extension for the people of the continent of Africa."
Reading the decision - reached by a majority of four to two among the judges - Chief Justice David Maraga said the 8 August poll had not been "conducted in accordance with the constitution".
Opposition supporters were seen celebrating outside the court building, as well as in opposition strongholds.