This post has been corrected. See bottom for details.
JOHANNESBURG, South Africa -- At least 39 people were killed and 150 injured Saturday when masked gunmen stormed an upscale shopping mall in Nairobi, the Kenyan capital, shooting people and taking hostages, President Uhuru Kenyatta said in a live statement on national television.
Kenyatta said that he lost close family members in the ongoing attack at Westgate mall, which is popular with wealthy Kenyans and expatriates. Police and government officials were swift to call it a terrorist attack, with witnesses reporting that non-Muslims were targeted.
"The despicable perpetrators of this cowardly act hoped to intimate, divide and cause despondency amongst Kenyans," Kenyatta said. "We have overcome terrorist attacks before. We have fought courageously and defeated them in and outside our borders. We will defeat them again."
The U.S. State Department said it had received reports that Americans were among the injured but provided no details, citing privacy concerns.
"We condemn this senseless act of violence that has resulted in death and injury for many innocent men, women, and children," State Department spokeswoman Marie Hart said in a statement. "Our condolences go out to the families and friends of all victims."
The Al Qaeda-linked Somali militant group Shabab claimed responsibility for the attack in a series of tweets, saying it was revenge for Kenya’s push into Somalia in 2011.
"The attack at #WestGateMall is just a very tiny fraction of what Muslims in Somalia experience at the hands of Kenyan invaders," the group’s media office said in one tweet.
The Shabab said that Kenyan authorities had been in touch with the group to try to negotiate the release of hostages.
"The Kenyan government is pleading with our Mujahideen inside the mall for negotiations. There will be no negotiations whatsoever at #Westgate," the Shabab tweeted late Saturday.
The militant group has shown resurgent strength in recent months after being driven from Mogadishu, the Somali capital, in 2011 by a U.S.-backed force from African Union countries.
The Shabab has been implicated in previous grenade attacks, shootings and bombings in Kenya, which sent troops into southern Somalia in 2011 and pushed the group's fighters out of the port city of Kismayo, once a key source of the Shabab's revenue. But Kenya's troops have struggled to quell the Islamists' control over the countryside.
The Kenyan army and special forces were called in Saturday to reinforce police at Westgate mall. Military and police helicopters flew overhead as ambulances raced victims to nearby hospitals.
Kenyatta said the operation was "delicate," because the main priority was to save the lives of hostages. But he vowed that all the terrorists would be caught.
"I urge all Kenyans to stand together and see this dark moment through," he said in the televised statement.
Gun battles with the attackers continued into the night Saturday. By about 9 p.m., police and special forces had the gunmen surrounded in an area within the shopping complex, Kenyan news reports said.
Citizen TV aired video of victims arriving at a hospital by ambulance, including some who had been shot in the head, people covered with blood and women weeping.
Mutea Iringo, head of Kenya’s Department of Internal Security, said authorities were "taking every measure possible to contain the situation."
“I wish to give reassurance that the government is now fully in charge of the situation and we are confident that the security services will soon bring this matter ... under control,” he said at a news conference. “The government is not taking any chances and had deployed sufficient security services at the scene including specialized units.”
Local news reports said gunmen were holding dozens of hostages.
Traumatized shoppers fled after about five gunmen ran into the mall at lunchtime, threw a grenade and opened fire.
"The casualties are many," Red Cross Society spokesman Abbas Guled told the Reuters news agency.
Presidential spokesman Manoah Esipisu said the police operation was continuing, with some hostages rescued.
Kenyan Police Inspector General David Kimaiyo told local news media that the rescued hostages were being screened for possible links to the attackers: "We are not taking chances," the Nation newspaper reported him as saying.
The gunmen appeared to have entered the mall through a cafe with an outdoor seating area.
"We started by hearing gunshots downstairs and outside. Later we heard them come inside. We took cover. Then we saw two gunmen wearing black turbans. I saw them shoot," said an employee at the cafe, Patricia Kuria, the Associated Press reported.
The gunmen targeted non-Muslims and ordered Muslims to leave the mall, according to Elijah Kamau, who was in the mall at the time, Associated Press reported.
"The gunmen told Muslims to stand up and leave. They were safe, and non-Muslims would be targeted," he said.
After the attacks, terrified shoppers trapped in the mall took shelter in shops and a movie theater.
For the record, 3:56 p.m.: An earlier version of this post incorrectly said that Al Shabab was driven from the Somali capital, Mogadishu, in 2012. The correct year is 2011.
Staff writer David S. Cloud contributed to this report from Washington.