(CNN) -- Al-Shabaab, al-Qaeda's brutal Somali affiliate, has claimed credit for the attack by multiple gunmen at an upscale shopping mall in Nairobi, Kenya that has already killed at least 39 people.
This should not be a surprise. For Al-Shabaab, the mall was an attractive target because Westerners, including Americans, frequented it. The mall is also in the capital of Kenya, a country that Al-Shabaab has good reason to dislike, as the Kenyan military played a major role in handing their forces a defeat last year when they liberated the key Somali port of Kismayo from their control.
Al-Shabaab ("the Youth") tweeted Saturday that "all Muslims inside #Westgate" -- referring to the mall that was attacked in Nairobi -- "were escorted out by the Mujahideen before" the armed assault commenced.
Members of Al-Shabaab use Twitter frequently to communicate their messages to the world. The group has recruited around 40 young American men and also dozens from Europe and has shown that it is comfortable with Internet technology, despite the fact that Somalia is one of the poorest and most anarchic countries on the planet.
More than 10% of the Kenyan population is Muslim. So it is interesting that Shabaab took the precaution of evacuating Muslims from the Nairobi mall they were attacking, suggesting a greater sophistication in the tactics of this attack than the group has shown hitherto in Somalia, where they have killed large numbers of civilians indiscriminately in a country that is almost entirely Muslim.
Before he was killed by U.S. Navy SEALs two years ago, even Osama bin Laden had scolded members of Al-Shabaab, telling them to try to avoid killing Muslim civilians.
In a letter that was recovered in the house in Pakistan where bin Laden was killed, al-Qaeda's leader warned Shabaab members that they were killing too many civilians in battles in and around the key Bakara market in the Somali capital, Mogadishu.
Saturday's attack on the Nairobi mall seems to owe some of its tactics to Lashkar-e-Taiba, the Pakistani terrorist group that attacked upscale hotels catering to Westerners in Mumbai, India, in November 2008 over the course of more than three days, killing 166 people.
In both the Nairobi and Mumbai attacks, a group of armed gunmen shot at civilians indiscriminately and conducted the operation in manner that would guarantee sustained media coverage over many hours and even days by taking a large number of hostages. In both assaults, the gunmen did not negotiate for the release of hostages but went into the operation seemingly prepared for a fight to the death.
A rescue worker helps a child outside the Westgate Mall in Nairobi, Kenya Saturday, September 21. Gunmen burst into the mall and opened fire in a deadly attack. According to a senior Kenyan government source, the gunmen took an unknown number of hostages, and police are trying to negotiate for their release and retake the building. Several hours after the attack, Al-Shabaab, an al-Qaeda-linked militant group based in Somalia, claimed responsibility for the deadly attack.
People who had been hiding inside the mall during the gun battle flee the scene.
A soldier directs people up a stairway inside the Westgate shopping mall during a shootout in Nairobi, Kenya, on Saturday, September 21.
Shoppers run with their arms raised as they exit the mall.
Armed officials take up positions in a parking area of the mall.
An injured man is wheeled into the Aga Khan Hospital in Nairobi.
People run from the Westgate Mall.
A Kenyan woman is helped to safety after the masked gunmen stormed the upscale mall and sprayed gunfire on shoppers and staff.
Crowds gather outside the upscale shopping mall. The interior ministry urges Kenyans to keep off the roads near the mall so police can ensure everyone inside has been evacuated to safety.
A policeman carries a baby to safety. Authorities said multiple shooters were at the scene.
Bodies lie outside the shopping mall. A Kenyan government source and Western diplomatic sources say the attackers appear to be of Somali origin.
A security officer helps a wounded woman outside.
A wounded woman is helped to safety after the attack. The military asked local media not to televise anything live because the gunmen are watching the screens in the mall.
Paramedics treat an injured man outside the mall.
Medical personnel carry a body away.
A body lies outside the mall. Gunmen shot people outside the mall as they entered it
A woman is pulled by a shopping cart to an ambulance.
A wounded man is escorted outside the mall.
A police officer carries a baby as people keep low and run to safety. Crowds dashed down the streets as soldiers in military fatigues, guns cocked, crawled under cars to get closer to the mall.
People run away from the scene.
Armed Kenyan forces take position to secure the area around the shopping mall as ambulances move in to carry the injured.
Family members who were trapped inside manage to escape. One mall visitor said people ran outside but would return inside upon hearing gunfire coming from outdoors.
A woman reacts after she is rescued from the mall.
A couple flee the area. As night fell, authorities said they had cornered the gunmen in the mall.
Armed police leave after entering the mall. At least one suspect has been killed, a government official said. Police have said another suspected gunman has been detained at a Nairobi hospital.
Armed police take cover behind escalators as smoke fills the air. Witnesses say tear gas was thrown in the corridors.
A woman who had been hiding during the attack runs for cover after armed police enter the mall.
A body is seen on the floor inside the smoke-filled four-story mall.
An injured person is helped on arrival at the Aga Khan Hospital in Nairobi after the attack at the upscale mall.
An armed police officer takes cover during a volley of gunfire outside the mall.
Photos: Kenya mall attack
Kenya president: Stand together
Terrorists attack mall in Kenya
Al-Shabaab has previously shown that it is capable of carrying out operations outside of Somalia, bombing two groups of fans watching the World Cup on television in Kampala, Uganda, on July 11, 2010, killing more than 70. The group seemed to have carried out that operation because Uganda had provided troops to a United Nations-authorized African Union mission then fighting Al-Shabaab in Somalia.
The group has also shown an interest in targets in the West. Eight months before the attack in Uganda, a 28-year-old Somali man armed with a knife and an ax had forced himself into the home of Kurt Westergaard -- a Danish cartoonist who had depicted the Prophet Mohammed with a bomb in his turban -- and tried unsuccessfully to break into the panic room where Westergaard was hiding. Danish intelligence officials said the suspect had links with Al-Shabaab.
Al-Shabaab has managed to plant al-Qaeda-like ideas into the heads of even its American recruits.
Shirwa Ahmed, an ethnic Somali, graduated from high school in Minneapolis in 2003, then worked pushing passengers in wheelchairs at the Minneapolis airport. During this period Ahmed was radicalized; the exact mechanisms of that radicalization are still murky, but in late 2007 he traveled to Somalia.
About a year later, on October 29, 2008, Ahmed drove a truck loaded with explosives toward a government compound in Puntland, northern Somalia, blowing himself up and killing about 20 people, including United Nations peacekeeping troops and international humanitarian assistance workers. The FBI matched Ahmed's finger, recovered at the scene, to fingerprints already on file for him. Ahmed was the first American terrorist suicide attacker anywhere.
The attack on the Nairobi mall may be an attempt by Al-Shabaab to signal its continued relevance. Over the past three years, Al-Shabaab has lost substantial territory and influence in Somalia. Al-Shabaab controlled much of southern Somalia in 2010, but operations by African Union and Kenyan forces have ended its domination of southern Somalia.
In 2011, the U.N.-sanctioned African Union mission partnered with Somali troops to fight Al-Shabaab militants, and in August of that year, AMISOM and Somali government forces defeated Al-Shabaab forces in Mogadishu, forcing the militants from a stronghold they had controlled since 2009.
Although Al-Shabaab has long been regarded as a regional offshoot of al-Qaeda, its leaders only declared their formal ties to the international terror organization in February 2012.
While the group seems to have been interested in an alliance before then, in 2010, bin Laden instructed the group's leaders to keep their association with al-Qaeda a secret, fearing that openly linking the groups would be bad for Al-Shabaab's fundraising efforts.
By February 2012, however, bin Laden was dead and Al-Shabaab had suffered significant losses in its southern Somali safe haven.
Al-Qaeda's new leader, Ayman al-Zawahiri, who had earlier petitioned bin Laden to reconsider his views about the proposed merger between Al-Shabaab and al-Qaeda, believed the time was right to announce formal ties between the two groups.
While there are a number of American citizens fighting for a variety of al-Qaeda-affiliated or -inspired organizations, Al-Shabaab seems to boast the most American fighters. According to a 2011 report by the House Committee on Homeland Security, an estimated 40 Americans have joined Al-Shabaab in the last few years, at least 24 of them coming from the Somali community in Minnesota.
Al-Shabaab has prominently featured these recruits in its propaganda operations, releasing three official videos that starred Abu Mansoor al-Amriki ("the father of Mansoor, the American"), who is actually Omar Hammami, in his late 20s from Alabama, who was raised as a Baptist and converted to Islam in high school.
One of the videos shows Hammami preparing an ambush and features English rap lyrics extolling jihad.
Hammami was reported to have been killed on September 12 during the course of some kind of an internal conflict within the Al-Shabaab group.
The news of his death was confirmed on Hammami's Twitter account four days later.