Updated

Kenya saw deadly violence overnight after the election commission declared that President Uhuru Kenyatta had won a second term while the opposition called Tuesday's vote a "charade." The East African economic power has a recent history of unrest after elections, especially the 2007 one that led to more than 1,000 people being killed.

Here's a look at recent elections and their aftermath and why Kenyans are watching nervously today:

___

2007: DEADLY RAMPAGE

What was arguably Kenya's worst violence since independence erupted immediately after it was announced that President Mwai Kibaki had won re-election in a close race against opposition leader Raila Odinga.

More than 1,000 people died and 600,000 were evicted from their homes, while international observers called the vote flawed. Kenyatta, the son of Kenya's first president and a Kibaki ally, later faced criminal charges at the International Criminal Court over his alleged role in orchestrating the ethnic violence. Those charges were dropped due to lack of evidence, with the ICC prosecutor blaming unprecedented witness interference and bribery.

___

2013: LEGAL CHALLENGE

With Kibaki's support, Kenyatta won his first term in a vote so close — 50.03 percent — that perennial challenger Odinga filed a legal challenge. It was unsuccessful.

In a dramatic example of Kenya's shifting political alliances, the politician who had backed Odinga in 2007, William Ruto, joined forces with Kenyatta for the 2013 vote and became deputy president.

Kenya was far calmer after the election results were announced, and the government had begun reforms that included adopting a new constitution to check the president's powers.

___

2017: ALLEGED HACKING

The torture and killing of the Kenyan election official in charge of the electronic voting system shortly before the vote sparked early concerns. Then the American CEO of a campaign data firm working with Odinga was deported the weekend before the vote.

Odinga has claimed the election commission's database was hacked and results manipulated in favor of Kenyatta, who won with 54 percent of the vote to Odinga's 44 percent. But international observers said they saw no signs of interference with the vote, and the commission said there had been a hacking attempt but it failed.

At least three deaths were reported in the days between the election and the announcement of the results Friday night as opposition supporters protested and clashed with police. Another at least two deaths were reported overnight after Kenyatta was declared the winner.