Kenyan Prime Minister Raila Odinga has filed a Supreme Court appeal against Uhuru Kenyatta's narrow victory in the presidential election's first round.
Mr Kenyatta beat Mr Odinga comfortably by 50.7% to 43.28% on 4 March, but avoided a run-off by only 8,100 votes.
But Mr Odinga has accused the electoral authorities of manipulating the result.
Police fired tear gas to disperse about 100 supporters of his Coalition for Reforms and Democracy (Cord) who had gathered outside the Supreme Court.
The police had warned them that they would not be allowed to do so.
Some of the crowd were wearing t-shirt bearing slogans including "I support the petition" and "Democracy on trial".
The presidential, legislative and municipal elections held 12 days ago were the first since the 2007 poll which set off ethnic and political violence in which more than 1,200 people were killed.
Mr Kenyatta and his running mate, William Ruto, are facing trial on charges of crimes against humanity at the International Criminal Court (ICC) for allegedly fuelling the unrest. They deny the charges.
Lawyers for Mr Odinga said their petition to the Supreme Court included allegations of vote manipulation, as well as problems with the registration of voters and an electronic vote counting mechanism.
"These failures dwarf anything Kenyans have ever witnessed in any previous election," Mr Odinga told reporters in Nairobi.
However, the prime minister urged his supporters not to resort to violence.
"We cannot begin what is supposed to be a new era under a new constitution in the same old ways," he added, referring to the charter adopted in 2010.
The Minister of Lands, James Orengo, a key ally of Mr Odinga, said their party had a constitutional right to file the petition and a "strong case".
"Expect a new election, and this time around no monkey-business. I think we're going to win and win in the first round," he told KTN TV.
"I can assure you that we have the evidence, and we have the will and the preparedness to prosecute the petition," he added.
Mr Orengo nevertheless promised that Cord would respect the Supreme Court's ruling if it went against the party, and urged Mr Kenyatta and his supporters to declare that they would do likewise.