The siege by armed gunmen at the Westgate Shopping Centre in Nairobi should not come as a surprise. Unfortunately Kenya has long been a terrorist target.
Just over a month ago, US President Barack Obama and former president George W Bush attended a ceremony that marked the 15th anniversary of the 17 August 1998 bombings by al Qaeda of the US embassies in Nairobi and Dar es Salaam, Tanzania, that killed 224 and injured thousands.
In 2002, militants bombed an Israeli-owned luxury hotel near Mombasa, killing 13 people, and also tried to shoot down an Israeli airliner. Kenya's decision in October 2011 to become directly involved in military operations in Somalia against al Shabaab increased the chances of a reprisal act of terror by its supporters and heightened the threat.
A group of over a dozen heavily armed gunmen attacked the Westgate shopping centre on 21 September.
Over 175 are known to be injured, including Kenyans and foreigners, and among the confirmed dead are British, French, Canadians, a Ghanaian and Chinese. In an address to the Kenyan nation, the country's President Uhuru Kenyatta, confirmed his family had been impacted - by the killing of his nephew and fiancée.
Through social media al Shabaab has claimed responsibility. There is little reason to doubt this claim by al Shabaab, and survivors who escaped from the attack mention that some of the gunmen targeted non-Muslims.
Since October 2011 a spate of retaliatory gun and grenade attacks have occurred in Kenya, killing at least 48 people and injuring around 200 in 17 separate incidents. Four of these attacks occurred in Nairobi, and four in Mombasa. Shops, bars, churches, police vehicles, a religious gathering and a bus station have been targeted.
Neighbouring Uganda has also been targeted, and at least 74 people were killed in twin bomb attacks by al Shabaab in Kampala in 2010. Militants have also attacked religious gatherings in Tanzania and a spate of acid attacks in Zanzibar including against British tourists shows a worrying trend.
When I was last in Nairobi and visited a Westgate restaurant, prosperous Kenyans could be seen enjoying their weekend. I never imagined the shopping centre would become headline news for a brutal terrorist siege.
It is easy to believe that the security threats are exaggerated and complacency can set in. The truth is that there are small networks of sympathisers to radical Islamist causes in Kenya and also apparently in Tanzania.
It was only a matter of time before a high profile target such as Westgate was attacked. For some years Nairobi's Kenyatta International Airport has been regarded by Western intelligence agencies as particularly vulnerable, and international airlines have invested in additional security screening procedures that seem to have reduced the risk.
East African governments have also responded by beefing up their anti-terrorism laws. In 2012, Kenyan lawmakers passed the country's first anti-terrorism law.
It provides the security forces the right to arrest terrorist suspects, to seize property and intercept communications; but it has already been badly abused as an excuse particularly by the police to harass and raid Somali refugee and Muslim communities on the Kenyan coast. As we have seen elsewhere, this deepens resentment and can radicalize individuals and communities further.
Today, one day after the attack, Kenya's politicians have united to condemn the Westgate terrorist atrocity. But any knee-jerk, emotive response against Somali and Muslim citizens and residents of Kenya could backfire. Improving intelligence, security and continuing to encourage a settlement in Somalia which could accommodate moderate parts of al Shabaab has to continue.
The Westgate terror attack is designed to draw an emotive response from Kenyan policymakers and their allies. Attempting to end the Westgate siege with minimum further loss of life is obviously the immediate priority, but smart long-term strategies to engage Kenya's Somali and Muslim communities in order to avoid further radicalization will become increasingly important.