Kenyan police, troops and special forces then moved in and went shop-to-shop inside the shopping centre. Foreign security officials – from Israel, the United States and Britain – were also seen at the complex.
An AFPTV reporter said she saw at least 20 people rescued from a toy shop, some of them children taken away on stretchers.
Kenneth Kerich, who was shopping when the attack happened, described scenes of utter panic.
“I suddenly heard gunshots and saw everyone running around so we lay down. I saw two people who were lying down and bleeding, I think they were hit by bullets,” he said.
“The gunmen tried to fire at my head but missed. I saw at least 50 people shot,” mall employee Sudjar Singh told AFP.
A spokesman for Shabaab said the attack was retaliation for Kenya’s nearly two-year-old military presence in war-torn Somalia in support of the internationally-backed Mogadishu government.
“We have warned Kenya of that attack but it ignored (us), still forcefully holding our lands… while killing our innocent civilians,” Shabaab’s spokesman Sheik Ali Mohamud Rage said in a statement.
“If you want Kenya in peace, it will not happen as long as your boys are in our lands,” the statement said.
The group also issued a string of statements via Twitter, one of them claiming that Muslims in the centre had been “escorted out by the Mujahideen before beginning the attack”.
Police at the scene said a suspect wounded in the firefight had been detained and taken to hospital under armed guard, but later died of his injuries.
Paris confirmed that two French citizens were among those killed in what it condemned as a “cowardly” attack. Canada’s Prime Minister Stephen Harper said two Canadians, one of them a diplomat, were among the dead, while Xinhua said one Chinese woman was killed and her child wounded.
The United States said its citizens were reportedly among those injured by the “despicable” act. British Foreign Secretary William Hague said there were “undoubtedly British nationals caught up in this so we should be ready for that”.
The UN Security Council condemned “in the strongest possible terms” the attack.