NAIROBI, Kenya -- Masked gunmen stormed into a fancy, crowded mall in Nairobi on Saturday and shot dead at least 39 people in one of the most chilling terrorist attacks in East Africa since Al Qaeda blew up two American Embassies in 1998.
Parents threw their bodies over their children, people climbed into ventilation shafts to save themselves, and shoppers huddled behind the plastic mannequins of designer clothing stores as two squads of gunmen moved through the mall shooting shoppers in the head.
The mall, called Westgate, is a symbol of Kenya's rising prosperity, an impressive five-story building where Kenyans can buy expensive cups of frozen yogurt and plates of sushi. On Saturdays, it is especially crowded, with loose, sometimes lackadaisical security. American officials have long warned that malls are ripe targets for Islamist terrorists, especially Westgate, because a cafe on the ground floor is owned by Israelis.
Fred Ngoga Gateretse, an official with the African Union, was having coffee at that cafe, ArtCaffe, around noon when he heard two deafening blasts. He cowered on the floor and watched eight gunmen with scarves twisted over their faces firing at shoppers and then up at Kenyan police officers who were shooting down from a balcony as panicked shoppers dashed for cover. "Believe me, these guys were good shooters," Mr. Gateretse said. "You could tell they were trained."
Several witnesses said the attackers shouted for Muslims to run away while they hunted down other shoppers. The mall, one of Nairobi's most luxurious, with gleaming escalators and some of the most expensive shops in town, is also popular with expatriates. It has served as the place for a power lunch, to catch a movie, to bring children for ice cream. On Saturday, the State Department said there were reports of injured American citizens but declined to elaborate, citing privacy considerations.
Several Western intelligence officials said they suspected that the attack was carried out by the Shabab, an Islamist militant group based in Somalia that has carried out suicide attacks and beheadings inside Somalia and threatened Kenyan malls before. A confidential United Nations report on Saturday described the attack as "a complex, two-prolonged assault" with two squads of gunmen dashing into the mall from different floors at the same time and opening fire immediately.
The Shabab sent out several Twitter messages after the massacre suggesting that its fighters were responsible for an attack they said represented "just a very tiny fraction of what Muslims in Somalia experience at the hands of Kenyan invaders." One message said the Shabab had warned the Kenyan government "that failure to remove its forces from Somalia would have severe consequences." Kenya sent troops into Somalia in 2011 to help fight the Shabab and to prevent violence from spilling over across the border the countries share.
The president of Kenya, Uhuru Kenyatta, said at least 39 had died and 150 were injured in the assault. "Terrorism is and of itself is a philosophy of cowards," he said in an address to the nation on Saturday night. "We are as brave and invincible as the lions on our coat of arms."
As midnight approached, Kenyan commandos had cornered several of the assailants on the third floor of the mall, witnesses said. Western officials said they expected that the assailants would fight to the death, though the Kenyan news media reported that one wounded gunman had been captured, and that he had later died in a hospital. Witnesses who escaped the mall said the assailants were holding hostages at gunpoint and one of the assailants was a woman.
Throughout the day, as the police cleared sections of the mall, terrified shoppers emerged with their hands up.
Stephen Opiyo, 25, who was working at a supermarket in the mall, said: "We heard gunshots and started running, trying to find an escape route. I saw many people who had suffered gunshot injuries."
Witnesses described attackers using AK-47 rifles and throwing grenades. Photographs from the scene showed a woman's bloody body being lifted out of a car, the glass of the window shattered.
Vivian Atieno, 26, who works on the first floor of the mall, described "intense shooting," starting around 11 a.m., before she escaped through a fire exit.
Haron Mwachia, 20, a cleaner at the mall, said he escaped by climbing over a wall. "I heard several gunshots and managed to run away," he said. "It was a horrible experience to me, and I was extremely afraid. I've never seen anything like it."
Kenya serves as the economic engine of East Africa, and while it has been mostly spared the violence and turmoil of many of its neighbors, it is no stranger to terrorist attacks. In 1998, Al Qaeda killed more than 200 people in an enormous truck bombing of the American Embassy in downtown Nairobi, while simultaneously attacking the American Embassy in Dar es Salaam, Tanzania. Islamist terrorists also struck an Israeli-owned hotel on Kenya's Indian Ocean coast in 2002 and fired missiles at an Israeli airliner.
More recently, the Shabab have put Kenya in its cross hairs, especially after Kenya sent thousands of troops into Somalia in 2011 to chase the Shabab away from its borders. The Shabab have attacked churches in eastern Kenya, mosques in Nairobi and government outposts along the desiccated Kenya-Somalia border.
But this was the boldest attack yet. Within minutes, as the gunmen opened fired with assault rifles, Westgate was plunged into mayhem and carnage. People ran out screaming and victims soaking in their own blood were wheeled out in shopping carts. Bodies were still sprawled on the mall's front steps hours afterward, and woozy shoppers continue to emerge from the stores where they had been hiding.
"This is such a shock," said Preeyam Sehmi, an artist, as she stumbled out of the mall, past a phalanx of Kenyan soldiers, after five hours of hiding. "Westgate was such a social place."
Ilana Stein, a spokeswoman for Israel's Ministry of Foreign Affairs, said the attack took place near ArtCaffe, an Israeli-owned coffee shop and bakery popular with foreigners that is one of 80 businesses in the mall. Ms. Stein said that one Israeli was lightly injured and three others escaped unharmed, and that the Kenyan interior minister said Israelis were not being targeted. "This time, the story is not about Israel," Ms. Stein said. "The minister is saying that this is an internal Kenyan issue. His security forces tell him that this terror organization was not targeting Israelis."
As the episode unfolded, helicopters hovered overhead while soldiers in flak jackets and helmets jogged single file into the mall, faces grim, guns cocked. The flashing lights of ambulances lighted up the mall's facade. Gunshots continued to ring out after nightfall, though the Kenyan authorities did not provide much information about what was happening inside the mall. Several Kenyan soldiers were wounded.
The Shabab, once again in a Twitter message, said the fighters inside the mall would not give up.
"There will be no negotiations whatsoever at #Westgate," the message said.
Jeffrey Gettleman reported from Nairobi, and Nicholas Kulish from Goma, Democratic Republic of Congo. Reuben Kyama and Tyler Hicks contributed reporting from Nairobi, and Jodi Rudoren from Jerusalem.
This article originally appeared in The New York Times.