Hopes that the inauguration of Kenyan President Uhuru Kenyatta would end months of election turmoil were dashed as at least three people were killed when police fired rifles and tear gas to break up a large opposition gathering.

Kenya Uhuru Kenyatta inauguration protests
A woman puts her hands up as riot police flush out opposition supporters who had taken cover in a shack to escape tear gas, during demonstrations in the Umoja suburb of Nairobi Tony Karumba/AFP

At a lavish inauguration ceremony attended by the heads of many African nations, Kenyatta did his best to paint a picture of a country moving beyond its divisions. "The elections are now firmly behind us ... I will devote my time and energy to build bridges," he told a rapturous crowd as he was sworn in for a second, five-year term in a sports stadium in Nairobi.

Less than an hour after he spoke, Kenyan national television carried pictures of riot police swinging clubs at civilians with their hands up.

During and after Kenyatta's inauguration, police elsewhere in the capital tried to stop the opposition from holding peaceful demonstrations to mourn dozens killed by police and militia since the original August election. Opposition leader Raila Odinga, who was shoved into his vehicle amid clouds of tear gas, put the death toll at three.

Photos and video show the crowd fleeing amid the sound of gunfire, and then helmeted security forces striking unarmed people with batons. Other people dipped water from slum puddles to clean their eyes. A witness, Isaac Mekenye, told AP that a seven-year-old boy was killed by a stray bullet as police chased opposition supporters. It was not immediately clear if the boy was among the three people Odinga reported dead.

Kenya Uhuru Kenyatta inauguration protests
People stand near the body of a man who was allegedly killed by a stray bullet during clashes between riot police and supporters of Kenyan opposition National Super Alliance (NASA) in Embakasi, on the outskirts of Nairobi Reuters

Kenya's election drama has meant months of uncertainty. The court nullified the August result, citing irregularities after a legal challenge by Odinga, and it ordered a new vote. Odinga and his supporters boycotted the repeat election, saying electoral reforms had not been made.

Odinga has called Kenyatta's inauguration a "coronation" instead, and he called Kenyatta a dictator and vowed to pursue fresh elections.

More than 70 people have been killed in political violence this election season, mostly by the police. Such killings are rarely investigated and police are almost never prosecuted. Human rights groups have repeatedly accused police of being used by Kenyatta's government to crush dissent.