NAIROBI, Kenya (AP) -- Kenya's Supreme Court on Saturday upheld the election of Uhuru Kenyatta as the country's next president and the loser accepted that verdict, ending an election season that riveted the nation with fears of a repeat of the 2007-08 postelection violence.
Jubilant Kenyatta supporters flooded the streets of downtown Nairobi, honking horns, blowing plastic noisemakers and chanting.
But supporters of defeated Prime Minister Raila Odinga angrily protested after the verdict and police fired tear gas at them outside the Supreme Court as well as in the lakeside city of Kisumu, Odinga's hometown.
Two young men participating in riots were fatally shot in Kisumu, police spokesman Masoud Mwinyi told The Associated Press, although it was not clear by whom, and residents there said they could hear gunshots late in the night.
Outbreaks of violence by Odinga supporters were also reported in some Nairobi slums and truckloads of police were called in to quell the demonstrations, according to reports on a police radio heard by an Associated Press reporter.
In a victory speech late Saturday, Kenyatta urged Kenyans to move past the election and pledged to "work with, and serve, all Kenyans without discrimination whatsoever."
"Above all, let us continue to pray for peace in our country," he said.
Odinga, who had challenged the election results, accepted the court ruling and urged national unity and peace.
"It is our view that this court process is another long road in our march toward democracy, for which we have long fought," he said. "The future of Kenya is bright. Let us not allow elections to divide us."
However, Odinga said it was unfortunate that some of his legal team's evidence had been disallowed by the court. This, he said after the court's verdict, means that "in the end Kenyans lost the right to know what indeed happened" in the counting of votes.
"Although we may not agree with some of its findings, and despite all the anomalies we have pointed out, our belief in constitutionalism remains supreme," he said. "Casting doubt on the judgment of the court could lead to higher political and economic uncertainty, and make it more difficult for our country to move forward."
Odinga wished Kenyatta success and said he hopes the incoming government "will have fidelity to our constitution, and implement it to the letter for the betterment of our people."
Saturday's Supreme Court verdict -- following a drawn-out court case that raised tensions across the nation -- means that Kenyatta, the son of Kenya's first president, is to be sworn in as president on April 9. He will become the second sitting president in Africa to face charges at the International Criminal Court.
Kenyatta and Deputy President-elect William Ruto both face charges that they helped orchestrate the 2007-08 postelection violence in which more than 1,000 people died. Both deny the charges. Ruto's trial is set to begin in late May; Kenyatta's is to start in July. Kenyatta has promised to report to The Hague.
Kenyatta's win may complicate the U.S. relationship with Kenya, which has the largest American embassy in Africa. Because of the ICC charges against Kenyatta, the U.S, Britain and other European countries have said they may have limited contact with Kenya's new president.
But Western powers can't completely sever the relationship. Kenya is a key component in the fight against the al-Qaida-linked Somali militant group al-Shabab. Additionally, as East Africa's largest economy, China is strongly courting Kenya's leaders, and the West will be loath to lose economic influence here.
The office of British Prime Minister David Cameron, whose government did not congratulate Kenyatta by name after he was declared the winner, said in a statement that Cameron wrote to Kenyatta on Saturday to note "his strong commitment to the partnership that exists between Kenya and the U.K." The statement said "the Kenyan people had made their sovereign choice" in electing Kenyatta.
The White House congratulated Kenyatta in a statement, which urged Kenyans "to peacefully accept the results of the election."
Lawyers for Odinga, the loser in Kenya's last two elections, had argued before the Supreme Court that the election was marred by irregularities and that Kenyatta did not win enough votes to avoid a runoff election. According to official results, Kenyatta won 50.07 percent of the vote, narrowly avoiding a runoff election against Odinga, who said his case before the Supreme Court would put Kenya's democracy on trial.
But the Supreme Court's unanimous decision, read out by Chief Justice Willy Mutunga, said the election was "conducted in compliance with the constitution and the law" and that Kenyatta and Ruto were legally elected.