Kenyan President Uhuru Kenyatta has branded judges in the country's Supreme Court "crooks" after they annulled his win in presidential elections. He earlier called for calm and said he would respect the Ruling but struck a more combative note at a Nairobi rally.
The court cited irregularities in last month's election and ordered a new one within 60 days.
The poll had raised fears of major violence similar to that following a disputed vote in 2007.
Although the unrest in this year's vote was not as serious as in 2007, days of sporadic protests left at least 28 people dead.
Kenya's election commission had declared Mr Kenyatta the winner by a margin of 1.4 million votes but the result was immediately challenged in court by his nearest rival, opposition leader Raila Odinga.
In a ruling on Friday, Chief Justice David Maraga said the 8 August election had not been conducted in accordance with the constitution, declaring it "invalid, null and void".
The ruling did not attribute any blame to President Kenyatta's party or campaign.
Mr Odinga, who was in the courtroom, smiled and pumped his fist in the air as the ruling was read out.
Thousands of his supporters took to the streets in celebration.
Mr Odinga, 72, said the ruling marked "a historic day for the people of Kenya and by extension for the people of the continent of Africa".
It is believed to be the first time in Africa that a legal challenge brought by the opposition against a presidential poll result has been successful.
Mr Odinga called the electoral commission "rotten" and called for its members to resign and face prosecution.
"It is clear that the real election results were never shared with Kenyans. Someone must take responsibility," he said.
"We won the elections and we are going to win them again."
In a televised address, President Kenyatta said that it was "important to respect the rule of law even if you disagree with the Supreme Court ruling".
He called for calm, saying: "Your neighbour will still be your neighbour, regardless of what has happened. My primary message today to every single Kenyan is peace. Let us be people of peace."
But he was struck a different tone later at a rally of supporters in a market in Nairobi.
He referred to Justice Maraga and his fellow judges as wakora (crooks in Swahili), saying they had "decided to cancel the election". He warned the chief justice that as the poll had been annulled he was now the president again, not president-elect.
"Do you understand me? Maraga should know that he is now dealing with the serving president," Mr Kenyatta, 55, said.
"We are keeping a close eye on them. But let us deal with the election first. We are not afraid."
Following the election, international monitors from the EU, the African Union and the US had said there was no major fraud and urged Mr Odinga to concede.
On Friday, Marietje Schaake, the head of the EU Observer Mission, said the Supreme Court ruling represented "a historic day for Kenya and we have always said that people who feel aggrieved should seek the path of the courts".
She said monitors had at the time pointed to irregularities and encouraged the Kenyan authorities to deal with them.
Ms Schaake said monitors were awaiting the full details of Friday's ruling.