By James Macharia and Humphrey Malalo

NAIROBI (Reuters) - Kenya's Supreme Court will handle any challenge to the result of last week's presidential election in a fair and speedy manner, the chief justice said on Monday, two days after defeated candidate Raila Odinga threatened legal action over the outcome.

Uhuru Kenyatta, indicted for crimes against humanity, was declared the winner on Saturday. Odinga refused to concede, although he urged his supporters to avoid any repeat of the violence that erupted after the last election in 2007.

Chief justice Willy Mutunga, appointed in 2011 to reform a legal system accused of serving the interests of the elite, said politicians and political parties had confidence in the judiciary to handle all electoral disputes.

A swift and transparent resolution of the dispute is seen as critical to restoring Kenya's reputation as a stable democracy, something that was helped by last week's largely peaceful vote.

"We at the Supreme Court are prepared to hear any petition that may be filed impartially, fairly, justly and without fear, ill-will, favor, prejudice or bias and in accordance with our constitution and our laws," Mutunga said.

The chief justice was speaking at a news conference held on the steps of the court after receiving a copy of the election results from electoral commission officials.

Several peaceful demonstrators waving Odinga posters near the gates to the court hours after Mutunga spoke, shouted: "We want Agwambo not the suspect", referring to Odinga, who is known as "Agwambo" or the daring one, and Kenyatta.

'DEMOCRACY ON TRIAL'

In rejecting the result, Prime Minister Odinga said "democracy was on trial in Kenya". His camp had raised complaints during tallying that the count was deeply flawed and called for it to be halted.

President-elect Kenyatta, now the deputy prime minister, won 50.07 percent of the vote, edging above the 50 percent needed to avoid a second round by about 8,400 of the 12.3 million votes cast.

International observers said the vote and count had been broadly transparent and the electoral commission said it had delivered a credible vote.

Kenyatta, Kenya's richest man and son of its founding president Jomo Kenyatta, faces trial at the International Criminal Court in The Hague on charges of playing a leading role in the wave of tribal killings that followed the disputed 2007 election.

How Western capitals deal with Kenya under Kenyatta and his government will depend on whether he and his running mate William Ruto, who is also indicted by the ICC, work with the tribunal. Both Kenyatta and Ruto deny the charges and have said they will work to clear their names.

The ICC prosecutor on Monday withdrew charges against one of Kenyatta's co-accused, senior government official Francis Muthaura, for lack of evidence.

The United States and other Western powers, big donors to Kenya, said before the vote that a Kenyatta win would complicate diplomatic ties with a nation viewed as a vital ally in a regional battle against militant Islam.

Mutunga said that the six Judges in the Supreme Court would hear any petition filed in the time allowed by the constitution, and invited the media to cover the proceedings live.

"I am sure that for justice to be done and to be manifestly seen to be done this public participation is absolutely necessary," he said.

CONFIDENCE

Odinga's Coalition for Reforms and Democracy (CORD) has up to seven days from Monday to file its case against the electoral commission, after Odinga said that "there was rampant illegality in the electoral process".

President Mwai Kibaki won a second term in 2007 after he was declared the winner by the then electoral commission, but Odinga said the vote was rigged and called for peaceful mass action.

However, riots broke out plunging Kenya into weeks of tribal bloodshed. Under a power-sharing deal brokered to end the violence, he was given the prime minister's post.

A new constitution, a key plank of the deal brokered by former U.N. chief Kofi Annan to end the post-election violence, has built public confidence in the courts.

Odinga said on Saturday his CORD alliance and most Kenyans had faith in a reformed judiciary and he would accept the Supreme Court's ruling on his petition. His comments quickly defused tensions in flashpoint areas.

(Editing by Giles Elgood)