WARNING: These images contain material that some viewers may find disturbing.
By Greg Botelho, Faith Karimi and Lillian Lesposo
NAIROBI, Kenya (CNN) -- Armed gunmen faced off with Kenyan police and soldiers inside an upscale Nairobi shopping mall early Sunday, hours after brazenly gunning down shoppers, diners and more.
Around 2:30 a.m. Sunday (6:30 p.m. ET Saturday) -- an hour after reporting five "visibly shaken" hostages had been released -- Kenya's National Disaster Operation Centre cryptically tweeted "major operations underway." What that meant was a mystery, and it didn't quell fears about what has happened or might happen to an unknown number of civilians who were still unaccounted for inside.
There were 39 confirmed dead as of around midnight Saturday, according to Kenya's president, who added his close relatives are among those killed. Two gunmen, including one who was detained after being shot, are also dead.
Francis Kimenia, secretary to the Cabinet, tweeted another 293 people got treatment at three area hospitals, which "are appealing for more blood." The wounded range in age from 2 to 78, the disaster operations center said, urging people to "remember them in your prayers."
Al-Shabaab, an al Qaeda-linked militant group based in Somalia with ties to Nairobi's Eastleigh district and whose most recent attack of this scale came July 2010 in Uganda's capital, claimed responsibility for the carnage and vowed not to negotiate with Kenyan authorities. It claimed that "all Muslims" were escorted from the mall before the attack, suggesting its targets were people who didn't believe in their extreme form of Islam.
"The Mujahideen are still strong inside #Westgate Mall and still holding their ground," the group said late Saturday via Twitter. "All praise is due to Allah!"
Kenyan authorities, though, insist they have the upper hand, where it's now early Sunday morning. The last few hours of Saturday and the first few of Sunday, in Kenya, were largely quiet outside the mall except for movement
Police tweeted that the attackers "have been isolated and pinned down in a room by security forces." And Joseph Ole Lenku, the national government's cabinet secretary for interior and coordination, hinted that the worst should be over.
"Our security forces have taken control of the situation," Lenku said.
"Attackers of Westgate shopping mall have been isolated and pinned down in a room by security forces in the ongoing operation," the national police said on Twitter.
Kenya's president, Uhuru Kenyatta, blasted "the despicable perpetrators of this cowardly act (who) hoped to intimidate, divide and cause despondency among Kenyans and would like to (create) a closed, fearful and fractured society."
Kenya is no stranger to terrorism, including a 1998 bombing at the U.S. Embassy in Nairobi that left 213 dead and other attacks before and since tied to al Qaeda and related groups.
In a televised speech late Saturday, Kenyatta said his nation has "overcome" such attacks before, refusing to budge from its values or relinquish his security. And it will do so again, he promised.
"We shall hunt down the perpetrators wherever they run to," the president said. "We shall get them, and we shall punish them for this heinous crime.
Midday peace shattered by gunfire, blasts
"Westgate Mall lends itself a serene and safe environment away from the city centre," the mall's official website states.
That may have been true before -- while there had been warnings, the high-end mall filled with more than 80 stores and restaurants had never been targeted. But it couldn't have been further from the truth Saturday.
Rattles of gunshots beginning around noon shattered any sense of peace or normalcy among those picking up groceries, savoring their lunch and browsing through the racks at stores.
Uche Kaigwa-Okoye was sipping his coffee when he heard what first sounded like a fallen table, then the continuing rat-a-tat of gunfire. As the gunshots became louder, people began screaming and running for the exits.
Some ran outside, only to turn around and headed back into the four-story mall when they realized bullets were flying there as well. Kaigwa-Okoye was among them, joining about 20 people who took shelter in a bathroom cubicle.
"They had grenades, and it was really, really loud," he told CNN, adding that he noticed tear gas in the corridors as well. "All of us felt like they were close."
As people texted family and friends outside the mall, word spread that nobody could be trusted -- and, even if the good guys could be sorted from the bad guys, the barrage of intermittent gunfire made any escape seem futile at times.
Sara Head, a Washington resident, experienced much of the same horror in the mall's parking garage. As her car pulled up, she and others heard the rattle of gunfire -- prompting them to crawl underneath and sneak behind cars before getting into a stairwell. She had company, including two people bleeding from gunshot wounds.
Eventually, the stairwell lights turned back on and the door to a nearby supermarket opened, so they dashed through the market and a nearby loading dock to safety.
"There was blood throughout the supermarket as we exited," Head recalled. "... It wasn't clear if it was OK to exit. I was short of sheep following."
Soldiers crawl under cars, copters fly overhead
By then it was clear that the once shiny, pristine Westgate mall had become a war zone.
That was shown as Kenyan soldiers in military fatigues, their guns cocked, crawled under cars to get closer to the mall, guns cocked.
Surveillance helicopters flew overhead.
Police took those rescued from the building to a secluded place for vetting to ensure they were not attackers. They streamed away from the mall in a straight line, arms raised up in the air.
The military asked local media not to televise anything live because the gunmen are watching the screens in the mall.
"We urge Kenyans to keep off Westgate mall, adjacent roads and its environs until further notice," the interior ministry said in a statement.
Most of the casualties are Kenyan, authorities said. But the mall is popular with expatriates and foreign nationals, who are among those killed and injured.
That includes two dead French nationals, their government said. Likewise, two Canadians -- one of them a diplomat -- died in the attack, according to Prime Minister Stephen Harper's office.
U.S. Secretary of State John Kerry said there were several Americans among the injured but none among the dead, though the wife of a foreign national working for the U.S. Agency for International Development was killed.
"As we prepare to bring the world's leaders at the United Nations next week," Kerry said in reference to the upcoming U.N. General Assembly, "we are reminded again in tragedy of our common humanity."
CNN's Faith Karimi and Greg Botelho reported and wrote from Atlanta; Lillian Lesposo reported from Nairobi. CNN's Michael Martinez, Chelsea Carter, Tim Lister, Nima Elbagir, Boriana Milanova, Jamie Crawford, Stefan Simons, Karen Smith and Azadeh Ansari contributed to this report.