Mwai Kibaki, Kenya's third president, who has died at the age of 90, will be remembered for ending the stranglehold of the former ruling party, but his legacy is overshadowed by the violence that followed the 2007 election in which more than 1,200 people died.
Trained as an economist, Kibaki ushered in a revolution when he first came to power in 2002 at the head of a grand coalition of opposition parties.
His presidency signalled the end of nearly four decades of domination by the Kenya African National Union (Kanu) - of which he was part for some 30 years.
Kibaki made moves to liberalise the economy, spurring rapid economic growth in his first term in power.
A new sense of pride and belonging consumed the nation and industrious Kenyans launched businesses across the country as improved infrastructure opened up new markets.
Kibaki also introduced free primary school education, transforming the lives of an estimated one million children who would not have otherwise gone to school.
His crushing victory over Kanu candidate Uhuru Kenyatta, who is now Kenya's president, represented a fresh start for the country.
The years of Kanu rule had been accompanied by the intimidation of opponents, the hollowing out of institutions meant to keep the government in check and rampant corruption.
"I believe that government exists to serve the people, not the people who serve the government," Kibaki told the excited crowds at his inauguration in 2002.
Fast-forward five years and his hurried swearing in after a disputed poll as clashes broke out across the country symbolised the collapse of that initial optimism.
In his first term, Kibaki as the head of a multi-ethnic coalition had the chance to heal the country's divisions, but the violence that followed the December 2007 election exposed the continued rifts.
An estimated 1,200 people were killed and around 600,000 fled their homes as people were targeted for their ethnicity.
Kibaki's allies were accused of rigging the vote which, according to the official tally, saw him narrowly triumph over Raila Odinga. An independent investigation later found that both sides had participated in electoral malpractices and said it was impossible to determine who had really won.
Announcing his predecessor's death, President Kenyatta described Kibaki "as a gentleman in Kenya's politics. A brilliant debater whose eloquence, wit and charm won the day time and time again."
But he was also known for his indecisive nature which prevented him from making the bold decisions that would have served the country better.
His first term called for a steely determination to defeat the divisive forces around him, as well as bring an end to corruption in the country. Instead he appeared to go along with them.
Kibaki also dashed the hopes of those who thought he would introduce a new constitution that would loosen the grip of the presidency on the country.
Instead he proposed one which appeared to do the opposite and it was rejected in a referendum in 2005.
There was also a sense of a missed opportunity in the fight against corruption, as many Kenyans were willing to back the crusade Kibaki had promised.
One of the most famous stories of the time was of citizens arresting traffic police officers who had asked for bribes in the midst of the government's well publicised anti-corruption campaign. It was big on words but light on action.
Kibaki had long been known as a fence sitter, but some attributed his weakness in the presidency to the ill-health which rendered him easily led by those who surrounded him.
During the 2002 election campaign he had been involved in a car accident - he was in a wheelchair when he was sworn in, with his leg still in plaster. It is believed he suffered a stroke shortly afterwards and emerged from hospital visibly affected.
The unrest and anger that followed the 2007 vote only ended with the intervention of former UN Secretary General Kofi Annan who brokered a power-sharing deal.
Kibaki remained president, while Mr Odinga occupied the new post of prime minister.
A new constitution that devolved power was then agreed in the wake of the violence.
Kibaki stepped down in 2013 after reaching the constitutional limit of two terms, and retired from more than five decades in public service.
He was born in 1931, while Kenya was still under British rule, in a village in the country's Central Province.
He went on to study economics at Uganda's prestigious Makerere University and then won a Commonwealth scholarship to study public finance at the London School of Economics.
In the late 1950s he was teaching economics back at Makerere, but decided to get involved in Kenyan politics and became an MP in 1963.
He was a key part of Kanu administrations, first as a finance minister, under the country's first president, Jomo Kenyatta, and later as a vice-president, deputising for Daniel arap Moi.
But once a multi-party system was introduced in 1991 - a move he initially opposed - Kibaki jumped ship and became an opposition leader, twice running unsuccessfully for the presidency.
He was known for fiercely keeping the government in check, with an organised shadow cabinet that even presented an alternative budget.
His election in 2002 ushered in one of Kenya's finest moments, but his lack of courage, and sometimes tact, mean the opportunities were squandered.