There has been precious little good news from Africa in recent months. Power outages in South Africa, the deepening crisis in Zimbabwe and ethnic tension in Kenya have given the continent unwelcome publicity.

But that trend, hopefully, has been broken with the power-sharing deal in Kenya between President Mwai Kibaki and the opposition leader Raila Odinga.

Just days ago the talks looked on the verge of collapse, which would have plunged the country into another round of bloodletting and threatened its sovereign integrity. Armed militias on all sides of the political and ethnic divide were using the lull in violence to regroup.

The damage that two months of political and ethnic conflict has done to the country is hard to exaggerate - more than 1,000 dead, up to 600,000 people displaced and a flourishing economy damaged.

A truth and reconciliation commission and an independent review of the December 27 election had already been agreed but the entire deal hinged on power-sharing. Without that crucial element no comprehensive agreement was possible.

Credit for this must go, in large measure, to former UN secretary-general Kofi Annan whose tireless work helped the rival leaders overcome their suspicions. This was African diplomacy at its best.

For too long African politicians were accused of not being able to deal with the continent's problems but the Kenya deal shows they can tackle even the most challenging of situations.

Implementing the agreement will be the hard part. Signing a paper document is one thing, selling it to your supporters on the streets and telling them to put aside their weapons is much harder - but a start has been made.

The foundations are there to build on and a way forward is clear. For the first time in months the words optimism and Kenya can appear in the same sentence.