Kenya's High Court said Friday it lacked the jurisdiction to rule whether presidential hopeful Uhuru Kenyatta, who faces a crimes against humanity trial, is eligible to run for office next month.
With little time left before the March 4 election, the ruling effectively clears the way for Kenyatta to contest the polls, in which he is seen as one of the leading candidates for the country's top job.
"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 packed courtroom, saying only the Supreme Court could rule on the case.
Kenya is less than three weeks from a presidential election, the first since polls five years ago erupted into bloody ethnic violence that left more than 1,100 people dead and hundreds of thousand displaced.
The ruling also applies to Kenyatta's running mate William Ruto, who together lead the Jubilee Coalition party.
Both men face trial at the International Criminal Court (ICC) for alleged roles in orchestrating murder, rape and violence after the 2007 polls.
Judge Mbogoli Msagha said despite ICC charges "every citizen has the right to vie for office... an accused person is presumed innocent until proven guilty".
Around a hundred supporters of the pair -- who were not present in court -- celebrated after the ruling, chanting their names, shouting "elections now!", and waving placards.
"Our march towards forming a Jubilee government is still on course," Kenyatta wrote in a message on Twitter, shortly after the ruling. "Thank you for all your support and prayers this far. God is Great!"
Ruto added in a Twitter message that he believed his "quest for leadership will be decided by the people of Kenya through the ballot."
Activists had sought a ruling as to whether the pair should be allowed to stand for office, as under a new constitution introduced in 2010, leaders must rule with "integrity".
"This is an issue that is within the exclusive jurisdiction of the Supreme Court," the judges' ruling said.
Moving the case to the higher court would require an application by the coalition of civil society organisations that launched the case.
"This is the official death of the constitution," said Lempaa Suiyanka, a spokesman for the civil society groups said, noting that since they must pay the costs of Kenyatta and Ruto, they lacked funds to continue.
"We are constrained by time and resources, we have not decided whether we will proceed with the case or not," Suiyanka added.
Judges said that since Kenya's election commission had already passed Kenyatta and Ruto as fit to stand for election, any ruling "would end up usurping" the powers of the commission.
The politically volatile case has been repeatedly delayed, and an earlier petition was unexpectedly withdrawn in December.
However, new applications were made, including by the Kenya Human Rights Commission, the Kenyan branch of the International Commission for Jurists, and the International Centre for Policy and Conflict.
They argued that the any person committed to trial at The Hague-based ICC would not be able to properly carry out their duties of running the country, while the honour and integrity of the public office would also be damaged.
Kenyatta, the deputy prime minister and son of Kenya's founding president, faces five charges of crimes against humanity, including murder, rape, persecution, deportation and other inhumane acts.
Ruto faces three charges of crimes against humanity.
Both have proclaimed their innocence, remain free and have promised to cooperate with the court.
The 2007-8 violence shattered Kenya's image as a beacon of stability in east Africa, and concerns are high over the risk of possible repeat violence.
Human Rights Watch have warned the risk of political violence is "perilously high", noting that the "underlying causes of past election-related violence remain in place."
At least 484 people were killed and over 116,000 fled their homes due to ethnic violence last year, according to the United Nations.