Masked gunmen stormed a packed upmarket shopping mall in Nairobi on Saturday, killing 39 people and wounding 150 more in a massacre claimed by Somalia's Al Qaeda-linked Shebab rebels.
The rebels said the carnage was in direct retaliation for Kenya's military intervention in Somalia, where African Union troops are battling the Islamists.
Kenyan President Uhuru Kenyatta said in a televised address to the nation that he had "personally lost family members in the Westgate attack", but said the country had "overcome terrorist attacks before, and we will defeat them again."
"Our security forces are in the process of neutralising the attackers and securing the mall," he said, as security operations went on late into the night -- nearly 12 hours after the assault began.
"They want to cause fear and despondency in our country, but we will not be cowed," Kenyatta said, adding: "Terrorism is a philosophy of cowards."
Kenyan police described the attackers as a well-organised "terror gang" numbering around 10.
The Westgate mall, popular with wealthy Kenyans and expatriates and part Israeli-owned, was packed with around 1,000 shoppers when it was besieged at midday.
After hours of sometimes ferocious gun battles, security sources said police and soldiers had finally "pinned down" the gunmen and managed to evacuate hundreds of shoppers and staff -- some of whom had spent hours in hiding.
One teenager recounted to AFP how he played dead to avoid being killed.
"I heard screams and gunshots all over the place. I got scared. I tried to run down the stairs and saw someone running towards the top, I ran back and hid behind one of the cars," he said from his hospital bed at MP Shah Hospital, where he was nursing burns to his hands and chest.
'We warned Kenya'
A spokesman for Shebab said the attack was a response to Kenya's nearly two-year-old military presence in war-torn Somalia in support of the internationally-backed government.
"We have warned Kenya of that attack but it ignored (us), still forcefully holding our lands... while killing our innocent civilians," Shebab'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.
"The Mujahideen entered #Westgate Mall today at around noon and are still inside the mall, fighting the #Kenyan Kuffar (infidels) inside their own turf," the group said via its @HSM_Press account.
The group said Muslims inside the centre had been "escorted out by the Mujahideen before beginning the attack."
It said the group was still in contact with the attackers.
"10 hours have passed and the Mujahideen are still strong inside #Westgate Mall and still holding their ground. All praise is due to Allah!" the group said.
The attack was the worst in Nairobi since an Al-Qaeda bombing at the US embassy killed more than 200 in 1998.
Shocked people of all races could be seen running away from the Westgate centre clutching children while others crawled along walls to avoid stray bullets.
A shop manager who managed to escape said at one point "it seemed that the shooters had taken control of all the mall".
"They spoke something that seemed like Arabic or Somali," said a man who escaped the mall and gave his name only as Jay. "I saw people being executed after being asked to say something."
Kenyan troops could be seen moving around and inside the shopping centre while special forces had joined the operation. An AFP reporter said she saw at least 20 people rescued from a toy shop. Dozens of wounded, some of them bleeding children, were taken away from the mall on stretchers.
Police at the scene said a suspect wounded in the firefight had been detained and taken to hospital under armed guard, but that he later died of his injuries.
Kenneth Kerich, who was shopping when the attack happened, described scenes of panic.
"I suddenly heard gunshots and saw everyone running around so we lied down. I saw two people who were lying down and bleeding, I think they were hit by bullets," he said.
An eyewitness who survived the assault said he saw the body of a child being wheeled out of the mall.
"The gunmen tried to fire at my head but missed. I saw at least 50 people shot," mall employee Sudjar Singh told AFP.
Vehicles riddled with bullet holes were left abandoned in front of the mall as the Red Cross appealed for blood donations and police instructed Nairobi residents to stay away.
Security agencies have regularly included the Westgate shopping centre on lists of sites they feared could be targeted by Al Qaeda-linked groups.
Paris confirmed that two French citizens were among those killed in what it condemned as a "cowardly" attack.
The United States said its citizens were reportedly among those injured and the White House condemned the "despicable" act.
British Foreign Secretary William Hague said that there were "undoubtedly British nationals caught up in this so we should be ready for that."
UN Secretary-General Ban Ki-moon was following the attack "closely and with alarm", a statement from his office said.