When the government called off the rescue operation at the Dusit complex yesterday morning after the tragic terrorist attack on Tuesday, there was a sense of triumph despite adversity.
Kenya had overcome its worst and looked ahead with courage and resolve to flourish in spite of its tribulations.
Statistically, at least 700 people were rescued in an operation that took about 12 hours and the gangsters neutered.
Fatalities were relatively lower; they have been quite high in the past.
Which is not to gloat, but make the point that Kenya has the capacity to win the war on terror; that the dark forces hell-bent on inflicting pain and damage cannot vanquish a nation and a people committed to the ultimate good of humanity.
Any life lost or injury inflicted is not acceptable and must be prevented at all costs.
But there were positives, nonetheless. Security teams were well-coordinated under the General Service Unit; there was a centralised chain of command and reasonably organised public communication inasmuch as the messaging was thin on details.
Civilian response was overwhelming and demonstrated our resilience and determination to defeat criminals.
Clearly, lessons had been learnt over the past decades that the country had been confronted by violence perpetrated by radicalised gangs.
Past experiences have been traumatic. For example, rescue operations during the Westgate Mall attack in 2013 went on for three nights and were largely bungled because of poor coordination.
Some 67 people were killed and dozens severely injured. GSU, which had initially commenced the rescue and who are known to best handle internal operations, were removed and replaced by the military, who normally deal with external aggression.
A similar situation obtained during the Garissa University College invasion of 2015 that caused 147 deaths, mostly of students, and many injuries as well as destruction of property.
The lesson is that tact, speed, proper coordination and effective communication are germane to diminishing the impact of such violence.
However, reports about the identity of the masterminds of the heinous act on Riverside Drive, Nairobi, paint a familiar tactic.
One of the suspects lived in a Kiambu neighbourhood, where he participated in communal activities and pretended to be sociable, yet remained secretive, with his personal details unknown.
Further, some of the suspects were frequent visitors to Dusit and patronised the restaurant, which gave them an opportunity to study and understand the environment and plan their mischief.
Similar tactics have been cited in previous attacks. Terrorists familiarise themselves with their target before striking.
Given such patterns, the antidote is pre-emptive strategies. That is why we have consistently talked about constant surveillance and active participation by civilians in security initiatives.
Periodically, the government has talked of community policing, aptly codified as the Nyumba Kumi (10 houses) initiative.
Central to this is involvement of every member of a community in policing one another; getting to understand who their neighbours are and, where there are doubts, reporting to the authorities.
This has worked out somewhat in some places, but not everywhere.
The latest incursion gives a compelling reason to mobilise communities to take charge of their own security, take a keener interest in their surroundings and report to security agencies when they have suspicion.
Which is not to suggest vindictiveness but responsive actions to forestall catastrophe.
We take assurance from President Kenyatta and other leaders that security forces will up their game, intensify surveillance and intelligence to forestall assaults by the gangs.
That the authorities will make Kenya inhospitable to the criminals through advanced security operations.
However, such declarations have been made in the past only for the criminals to strike again.
The President must ensure that the administration prioritises security through adequate funding, resourcing and technological upgrade to guarantee the safety of Kenyans.
Terrorism is a global phenomenon and no country is safe.
Kenya has, particularly, been hard-hit because of the chaos in neighbouring Somalia, which has not had a unitary government for decades.
Cross-border operations to flush out and tame the militants is, therefore, paramount.
To that extent, Kenya continues to keep its troops in Somalia to rein in the militants in their territory and block them from externalising violence.
That is why the peace mission in Somalia has to continue.