By James Macharia
NAIROBI (Reuters) - The U.S. Embassy in Kenya has warned its citizens of possible unrest this weekend when the Supreme Court is due to rule on a legal challenge to the outcome of the presidential election by losing candidate Raila Odinga.
Odinga alleged "rampant illegality" in the first-round victory this month of rival Uhuru Kenyatta, the son of Kenya's founding president, who has said the voting was free and fair.
The case is another test of Kenyan democracy five years after a disputed vote ignited tribal violence.
Americans form a large part of the expatriate community in a country that is a hub for trade, multinational firms and the regional headquarters for U.N. agencies and other humanitarian organizations.
Analysts say a swift, transparent resolution of the petition will be critical to restoring Kenya's reputation as a stable democracy, following post-election violence in early 2008 in which more than 1,200 people were killed.
The six supreme court judges are expected to deliver a ruling by Saturday in line with a strict legal deadline.
The U.S. Embassy warned its citizens to stay clear of any demonstrations, even if they appear peaceful.
"There could be a strong public reaction to the announcement; therefore, the U.S. Embassy strongly urges all U.S. citizens to avoid gatherings, demonstrations, downtown business areas, slums, and large crowds of any kind," an embassy statement said.
The Supreme Court's verdict on the case is final and both Odinga and Kenyatta have said they will abide by its decision.
Should Odinga win his challenge, it would mean a new presidential race that would further unnerve markets and prolong uncertainty in the region's trade gateway.
Kenyatta, 51, can only be sworn in if the court upholds his victory. The president-elect also faces trial at The Hague in July on charges of playing a leading role in the killings that followed the 2007 election. Kenyatta denies the charges.
Kenya's police inspector general, David Kimaiyo, said in a statement that a ban on rallies and demonstrations was still in place as part of efforts to avoid violence
Kimaiyo defended his stance which has been criticized by rights groups who say it violates Kenyans' rights and freedoms.
"No individuals should enjoy rights, whose enjoyment may imperil other individuals' rights as well," Kimaiyo said.
Chief Justice Willy Mutunga has repeatedly said the Supreme Court would handle the dispute fairly, and urged Kenyans to trust his court to deliver a verdict which they should accept.
On Monday, the court ordered a partial recount of ballots from the broadly peaceful March 4 presidential election after Odinga alleged there were more votes cast at some polling stations than there were registered voters.
On June 23, 2012, the U.S. Embassy warned of a threat of an attack on the Kenyan port city of Mombasa. A blast at a night club the following day killed one person.
(Additional reporting by Humphrey Malalo; Editing by Edmund Blair and Angus MacSwan)