By Karen Allen
BBC News, Nairobi
After nearly four days of counting, allegations of vote rigging and foul play, Mwai Kibaki was named the winner in Kenya's most tightly-fought presidential race.
Angry opposition supporters took to the streets in several cities
A hasty swearing in ceremony followed, in which the 76-year-old president declared that the vote was "free and fair". Thousands of Kenyans rioted on the streets, clearly thinking otherwise.
Within moments of the result being announced, violence erupted in two of Nairobi's slums.
In Kibera, the shanty town neighbourhood where his opponent Raila Odinga's political heartland lies, houses were burnt to the ground and vehicles set alight as police clashed with supporters of the defeated opposition presidential candidate.
There were similar scenes in Kisumu in the west of the country, the hometown of Mr Odinga.
With widespread allegations of vote rigging - and a dramatic claim from a "whistleblower" who alleged he was forced to take part in the scam - many of Mr Odinga's supporters feel they have been robbed of victory.
Within hours of the result being announced, a major crackdown was ordered on the media. Government officials saying it was necessary to ensure "public order and tranquillity"
President Kibaki was sworn in to serve his second five-year term
All live television and radio news broadcasts have been banned and media houses are coming under pressure from the authorities not to "inflame the situation".
One reporter interviewed on Nation TV, one of the main broadcasters in Kenya, said he felt "betrayed" and many of his colleagues are "stunned" by the move.
President Kibaki's administration had been praised in the past for opening up democratic space which has seen a vibrant news media evolve. Now a major clampdown seems to reverse that and there are fears of what may follow in the coming days.
There is widespread speculation that early on Monday President Kibaki will appoint a new cabinet.
Twenty of his ministers lost their seats in Thursday's vote. And he will be keen to try and seize back control of a country that has been plunged into violence, the likes of which many Kenyans say they have not seen in more than 15 years.
Far from tensions being eased, there are fears that they could be inflamed still further.
On Monday, Mr Odinga is calling on supporters to attend his parallel "swearing in" ceremony in the capital's Uhuru park. Many Kenyans recognise him as the rightful winner in this contest, and will not accept the final result.
Eric Kiraithe, the spokesman for Kenya's commission of police, on Sunday issued a statement warning that any person attending this meeting "will face the full force of the law".
And although there have been appeals for grievances to be dealt with by the courts, all the signs are that frustrations could well continue to be vented on Kenya's streets.