Kenyans are observing three days of mourning for the 61 civilians and six soldiers killed by heavily armed members of Somalia's al Qaeda affiliate, al Shabab, at a luxury mall in Nairobi.

Now that security forces have ended the siege — killing five terrorists, and arresting 11 more — investigators are moving in on Wednesday to sift through the rubble of the complex for clues about how the Islamist extremists of al Shabab pulled off the attack, and managed to hold off security forces for four days.

One lesson already made clear by the methodical operation of the terrorists is that an African Union-led offensive, which has pushed al Shabab out of its former urban strongholds, has forced the movement to evolve, but fallen far short of crushing it.

The sophisticated weekend raid goes beyond the group's hallmark hit-and-run tactics. American officials believe the attackers carefully planned the assault, studying blueprints of the mall, rehearsing, slipping over Kenya's porous border, and even stashing powerful belt-fed machine guns in a shop a day or two before the attack, according to The New York Times.

The mall attack also demonstrates that al Shabab has the resources it needs to make good on its threats to enemies outside its home turf. The group's leader, Ahmed Godane, "has been seeking to rebrand al Shabab as a significant international jihadist group," explain Abdi Sheikh and Richard Lough at Reuters, and he has been threatening to get revenge against Kenya for sending troops to join the African Union's fight against his militants.

The mall attack bears out Western fears that the insurgents would use Somalia, a hotspot in the U.S.-led war on Islamist militants across the globe, as a launch pad for strikes on regional countries even as African troops put them on the defensive in the Horn of Africa state. [Reuters]

That, along with reports that up to three of the attackers were American al Shabab recruits, has raised fears that al Shabab could even stage a similar strike in the U.S. The more immediate lesson, security experts say, is that Kenya is ill-prepared to contend with such a sophisticated terrorist operation, and it needs to bolster its defenses.

Not everybody sees it that way, though. Some experts believe that this kind of headline-grabbing attack against a defenseless soft target is a sign that the terrorists are getting weak and desperate as they lose the war at home, says Adam Nossiter at The New York Times.

Such bold assaults can therefore be read as flares in the night, some analysts say — the militants' attempt to show that they are still out there, and still capable of spilling blood. At the moment when they seem most menacing, the jihadists may in fact be on the run. [New York Times]

Another key question, however, is whether Kenya is able to learn from what happened, and use the experience to come up with an effective response. Declan Galvin at Foreign Policy notes that the attackers singled out non-Muslims — even warning Muslim mall-goers to get out before the shooting started. That suggests that al Shabab is trying to goad the Kenyan authorities into an overreaction against the Somali population in Kenya, Galvin says, and that would be a big mistake.

The government in Nairobi will need, of course, to attend to the justified fears of its population by carefully investigating the sources of this attack and doing what it can to prevent a replay. What the Kenyan government needs to keep in mind along the way, however, is that it can easily become its own worst enemy in its fight against al Shabab and terrorism. Both the Somali and Muslim communities in Kenya feel perennially victimized. Further alienating these communities will not only hinder Kenya's War on Terror, but will provide fertile ground for al Shabab's recruitment efforts. [Foreign Policy]

In other words, this horrific attack might be a sign of al Shabab's newfound strength to hit targets abroad, or it might be a sign of desperation. But whether it pays off for the terrorists depends on what Kenya does next.