Kenya's deputy Prime Minister Uhuru Kenyatta - accused of crimes against humanity - can stand in next month's election, after a court declined to bar him.
The High Court refused to rule in a case brought by campaign groups seeking to exclude him from the March 4 poll.
Mr Kenyatta and Prime Minister Raila Odinga are seen as the favourites.
Mr Kenyatta and his running mate William Ruto deny the charges brought against them in The Hague.
They are due to go on trial in April at the International Criminal Court (ICC) in connection with the violence that followed disputed elections in 2007.
"The High Court lacks jurisdiction to deal with a question relating to the election of a president," the panel of five judges said in a statement read to a crowded courtroom.
"This is an issue that is within the exclusive jurisdiction of the Supreme Court," the judges said.
The BBC's Will Ross in the capital, Nairobi, says Mr Kenyatta's supporters celebrated in the streets after the ruling was announced.
Correspondents say it is not immediately clear if any application would be made to move the case to the higher court.
The ICC case against four Kenyans - including Mr Kenyatta and Mr Ruto - is taking centre stage in the elections and was an issue that featured prominently in the first presidential debate last week between the eight leading candidates for the post.
Mr Kenyatta was forced to fend off claims of impunity during the debate and was put on the spot by the moderators and his presidential challengers who demanded to know why he would not pull out of the race to concentrate on his case at The Hague.
Both he and Mr Ruto have been indicted by the ICC for crimes against humanity emanating from the violence that killed more than 1,000 people and forced about 300,000 people from their homes after the disputed election that was won by President Mwai Kibaki, who is now stepping down after two terms.
Mr Kenyatta, the son of Kenya's founding president, faces five charges of crimes against humanity, including murder, rape, persecution, deportation and other inhumane acts.
Mr Ruto faces three charges of crimes against humanity.
Mr Kenyatta insisted during the debate that he and his running mate were innocent and would defend themselves vigorously.
The case would not prevent him from discharging his presidential duties, if he was elected, he said.
The Kenya Human Rights Commission, the Kenyan branch of the International Commission for Jurists, and the International Centre for Policy and Conflict have all argued that any person committed to trial at the ICC would not be able to carry out their duties of running the country properly.
They say that the honour and integrity of the public office would be damaged. - BBC