Announcing three days of national mourning, president Uhuru Kenyatta said that 61 civilians and six members of the security forces had been killed in the fighting, while 62 injured remained in hospital.
Towards the end of the operation, three floors of the Westgate complex collapsed and some bodies – including those of some of the terrorists – remained trapped in the rubble, he said. “As I had promised earlier, we have ashamed and defeated our attackers,” he said.
“I promise that we shall have full accountability for the mindless destruction, deaths, pain, loss and suffering we have all undergone as a national family. These cowards will meet justice, as will their accomplices, wherever they are.”
But while he said “the worst” of the crisis was now over, it was unclear whether Kenyan security forces had finally accounted for all the militants.
Earlier, al-Shabaab, the Somali terrorist group which carried out the attack, claimed that
its fighters were still resisting and holding a number of hostages.
Mr Kenyatta also confirmed that intelligence reports had been received suggesting that a British woman and “two or three” American nationals had been involved in the attack.
“We cannot confirm the details at present, but forensic experts are working to ascertain the nationalities of the terrorists,” he said in a televised address.
Ministers have already confirmed that there are at least six British nationals among the dead, with fears the number could rise.
The confirmation that a British woman may have among the attackers fuelled speculation that it was the terror suspect Samantha Lewthwaite, who was married to the 7/7 bomber Jermaine Lindsay.
Dubbed the “White Widow”, she is known to be in East Africa and is wanted by Kenyan police over alleged links to a terrorist cell that planned to bomb the country’s coast.
The Foreign Office earlier confirmed that it was aware of the claim, originally made by the Kenyan foreign minister Amina Mohamed while attending the United Nations General Assembly in New York.
“We continue to liaise very closely with the Kenyan authorities and to support their investigation into this attack,” a spokesman said.
While Mr Kenyatta did not say whether the suspected British woman was among those in custody, the fact forensic tests are being carried out would suggest she was one of those who had been killed.
Earlier, al-Shabaab had dismissed suggestions that a woman had been involved in the attack.
Last night, a British family who survived told of how terrified shoppers hid under tables as the armed attackers struck.
Anita Sanghani, who was trapped with her son, Kavi, in a mobile-phone shop for six hours, said she did not think the mall was targeted by terrorists at first, assuming they were “robbers”. She said: “I just closed the doors [of the shop] and my son was calling me, ‘Mum, come back, come back, come quickly.’”
Her son added: “It was terrifying, everyone was very emotional. It was really bad at the beginning, but then we all got together and kept quiet and laid down and waited for help.”
According to defence secretary Philip Hammond, at least six Britons had died in the attack. Other known foreign victims are from China, Ghana, France, the Netherlands and Canada.
Earlier on the fourth day of fighting at the five-storey complex one soldier emerging from the mall said: “We are finished.”
He then conceded that government forces were still trying to secure the entire interior.
He said troops were checking for explosives, and to see if they could find any survivors in certain areas, including the mall’s cinema and casino.
With mortuaries in the capital braced to receive more bodies, images appeared to show the part of the roof of the shopping centre as having collapsed following a fierce fire.
The attackers gave a conflicting account of the mall attack on social media. “There are countless number of bodies still scattered inside the mall, and the mujahideen are still holding their ground,” al-Shabaab said in a Twitter message. It added that the hostages are “still alive looking quite disconcerted but, nevertheless, alive”.
But police urged people to ignore “enemy propaganda” .
Speaking at the UN General Assembly, US President Barack Obama said that while the world was more stable than it was five years ago, the terrorist attack “indicates the dangers that remain”.
Mr Obama warned that al-Qaeda has splintered into regional networks and militias, and said that poses “serious threats to governments, diplomats, businesses and civilians across the globe”.