A child ran to safety at the mall Saturday.

NAIROBI, Kenya—The siege on an upscale shopping mall continued Sunday morning, with the wounded being evacuated after gunmen burst into the mall Saturday, killing dozens of people and injuring many more.

At least 59 people have been killed in the attacks and 175 injured, Kenya's interior cabinet secretary, Joseph Lenku, said Sunday. Among the wounded and injured are several foreigners and family members of Kenya's president.

On Sunday, security forces had cordoned off the streets surrounding the mall, but reporters were able to see at least one wounded soldier being transferred into an ambulance. Occasional gunshots could be heard.

In a televised address late Saturday, Kenyan President Uhuru Kenyatta offered his condolences to those who lost loved ones—and included himself in that group.

"I know what you feel having also personally lost very close family members in this attack," Mr. Kenyatta said, without elaborating further. He called the strike a terrorist attack and urged Kenyans not to give in to fear.

The death toll is expected to rise as police make their way through the large complex, which has three main floors and a smaller fourth floor housing a movie theater, to confront the assailants, who they believe are holding hostages.

The Kenyan government's National Disaster Operation Center said that Kenyan military and special forces had taken control of the upper floors of the mall but that lower floors were still unsecured.

It wasn't clear how many people were still trapped inside.

Saturday's rampage was the deadliest single attack in Nairobi since the 1998 bombing of the U.S. Embassy that killed more than 200 people, and is thought to have been carried out by Somali militants.

Canada said two of its citizens, including a diplomat, were among the dead, and the U.S. said that the wife of a foreign service national working for the U.S. Agency for International Development was killed and that American citizens were reported among the injured.

Patrons of the mall were sitting down for lunch or strolling through the facility when cars packed with an unknown number of gunmen drove up to the main entrance of the mall around 12:30 p.m. and started shooting as they rushed through the open doors where guests usually wait in line to have their bags checked by security guards, witnesses said.

The attackers shot into the crowds of people at outdoor restaurants and pushed farther into the mall, firing their weapons and throwing grenades as they raced to the higher levels of the mall. Shoppers crawled into back storerooms and bathrooms, locking doors where they could. At least one bank was able to lock its customers in a safe room, witnesses said. Those near exits raced out of the mall, some taking refuge in nearby apartment buildings to catch their breath and call family members.

Police arrived and cordoned off the parking lot, at first believing they were dealing with a robbery attempt. But as wounded survivors started piling into ambulances it became clear that the attackers had opened fire, that they hadn't appeared to be after anything and that they seemed to be targeting non-Muslims.

Police and military forces slowly started the work of pushing into the mall and pulling out those hiding and the injured while trying to close in on the attackers without knowing exactly how many assailants there were or where they were shooting from.

As survivors emerged, some with their hands up to show they weren't carrying weapons, Red Cross workers escorted them to a nearby building and assured them they were safe.

Gunmen stormed the Westgate shopping mall in Nairobi, throwing grenades and opening fire in an apparent terrorist attack. At least 39 people have been killed. Photo: AP

Somalia's al-Shabaab militant group, which has said it was planning an attack in Nairobi as retribution for Kenya sending troops into Somalia to fight the group, appeared to claim responsibility for the attack.

A posting on a Twitter account that has been used by al-Shabaab said the attackers belonged to their group. The Kenyan government "is pleading with our Mujahideen inside the mall for negotiations. There will be no negotiations," the author wrote.

Police officials declined to speculate on who carried out the attack.

"The whole thing is ongoing," said Nairobi Police Chief Benson Kibue earlier in the day. "We cannot comment on who the attackers are until we have got them."

Witnesses gave conflicting accounts about the attackers' appearance, with some saying they looked foreign and spoke Somali—a few wore long beards, which are uncommon in Kenya—and some wore turbans.

"I saw two men with white turbans and guns," said George Onyango, who ran out of the mall with two members of the family he works for and hid on the floor of his car as the attackers ran in. He said the attackers were shouting in Somali and running up to the top floor.

Another witness, 59-year-old French national Marcel Hale, said he saw a bearded gunman shooting toward him and yelling, "Allahu akbar!" Arabic for "God is Great!" Mr. Hale said that the bullet hit a stool and that he and his wife ran to a restaurant kitchen, where they hid until they were rescued by police. Both of them escaped unharmed.

A man helped a woman to safety after an attack on a Nairobi, Kenya, mall Saturday. Simon Maina/AFP/Getty Images

Other witnesses said the attackers didn't look foreign at all.

"They could have been Kenyans," said Sheila Akaliche, a waitress at a restaurant in the mall who saw the attackers enter and start shooting at diners. She said she saw two men wearing western clothes—black shirts and pants. Then she ran. Her colleague was shot in the arm as they fled.

A soldier outside the mall Associated Press

Nor was it clear how many assailants there were, but a policeman at the site, who declined to be identified because he wasn't authorized to speak to the media, said there was more than one car full of men. The Kenyan police inspector general, David Kimaiyo, said in a tweet that one gunman was wounded and that several others were pinned down by gunfire but didn't say how many attackers were there.

Later, Joseph Ole Lenku, the cabinet secretary for the interior, told reporters gathering in the parking lot of the mall that the situation had been brought under control. "Our people have reached most of the floors in the building." Meanwhile, many of those still trapped inside who had been sending text messages to friends started turning off their phones to conserve their batteries.

Canadian Prime Minister Stephen Harper said Annemarie Desloges, a liaison officer at Canada's High Commission to Kenya, was killed in the attack. Mr. Harper said Canada condemns "in the strongest possible terms this cowardly, hateful act."

The U.S. State Department said it had reports that U.S. citizens were injured in the attack. "We condemn this senseless act of violence," a spokeswoman said.

Westgate Mall is a regular weekend lunch and shopping destination for the country's new consumer class as well as foreign officials working at nearby embassies in Nairobi. On Saturday, the mall had been hosting a children's cooking event. It wasn't known what happened to the participants in the event.

Guards at the main entrance use metal detectors to check for weapons and search handbags before shoppers enter, a common precaution in high-crime Nairobi. The entrance itself isn't reinforced or protected from the street.

Although small-scale grenade attacks have taken place recently in Kenya's capital, large-scale and organized assaults are rare. Naeem Biviji, a 34-year-old who owns a furniture company with his wife, said they had been having lunch at one of the mall's outdoor cafes with two friends visiting from England when they heard shooting and dove to the floor. They crawled to a stairwell and eventually ran out a side entrance, his wife Bethan carrying their 7-month-old baby in her arms.

"We heard a lot of shooting and then one or two big booms," said Mr. Biviji. "The whole place smelled like fireworks." Neither he nor his companions saw the attackers.

Those who managed to get out of the mall said they were sending and receiving text messages inside about where the attackers were or what they might want.

Israeli businessman Eran Ochayon said that he received a text message saying that the assailants were asking people to recite the names of God in Arabic to show that they were Muslim and should therefore be spared. Mr. Ochayon wrote a number of the names on his hand in case he needed them. He said he also tossed aside his passport so he could not be identified as Israeli.

"I was assuming they were going to come in any second," he said. He waited like that, inside the locked Barclay's Bank branch, for hours before police came banging on the door and escorted him to safety.

—Idil Abshir in Nairobi and Karen Johnson in Ottawa contributed to this article.

Write to Heidi Vogt at heidi.vogt@wsj.com