Victims of the terror attack on the DusitD2 luxury hotel - including locals, US and British citizens - are being identified after the Kenyan President announced the attackers had been "eliminated".
Police chief Joseph Boinnet confirmed that at least 21 people were dead: 16 Kenyans including a police officer; an American 9/11 survivor; a British development professional; and three people of uncertain African nationalities.
Kenya's Red Cross earlier said about 50 people were still missing after Somalia-based militant group al-Shabab blasted their way into the luxury DusitD2 hotel complex in the Kenyan capital.
Confirming an end to the security operation at Dusit during a televised address on Wednesday (local time), about 19 hours after the attack began, President Uhuru Kenyatta said about 700 people had been safely evacuated.
It was not clear how many attackers there were, but AFP reported "five terrorists" had been involved.
Two suspects had also been arrested for helping the attackers, Mr Boinnet said. AFP reported police raided properties.
Mr Kenyatta said "every person that was involved in the funding, planning and execution of this heinous act" would be "relentlessly" pursued.
The "terror attack" on the upscale 14 Riverside Drive complex started after 3pm on Tuesday (local time).
The building is home to the local offices of international companies including BASF, Colgate Palmolive, Reckitt Benckiser, Pernod Ricard, Dow Chemical and SAP, as well as the dusitD2 hotel, part of the Thai hotel group Dusit Thani.
Many civilians remained holed up in the complex for several hours, as they hid from the attackers in bathrooms, and even under tables and chairs.
By the evening, all but the seventh floor of the complex had been cleared, but some civilians remained there, apparently in close proximity to the surviving attackers.
Photos showed some victims had been dining in the Secret Garden restaurant and lay slumped at tables.
Two friends, Abdalla Dahir and Feisal Ahmed, were having lunch together in the grounds of the hotel when the suicide bomber struck. Friends described the pair as inseparable.
US citizen Jason Spindler was among the dead. His brother, Jonathan, said on Twitter that Jason had survived the 9/11 attacks in New York in 2001.
In an interview with US broadcaster NBC, Sarah Spindler said her son was trying to "make a positive change in the third world in emerging markets".
British citizen Luke Potter, who held dual South African nationality, was also killed, and another Briton was wounded, the UK Foreign Office said.
Well-liked Kenyan James Oduor, commonly known as Cobra, also died. He was and known for his love of football, and tweeted as the attack was unfolding.
Kenya has seen a number of terror attacks in recent years - most notably in areas close to the Somali border and in the country's capital.
In April 2015, al-Shabaab militants raided Garissa university, killing 148 people in the most deadly assault Kenya has seen.
Two years earlier, Al-Shabaab gunmen entered Westgate shopping mall in Nairobi in September 2013, targeting shoppers and killing 67 people during an 80-hour siege.
Publication of victim photos criticised
Images of the victims published in global media including the UK's MailOnline, Germany's Bild and the New York Times have prompted criticism.
The speed with which the pictures were published meant many were still unaware their loved ones had been caught up in the attack.
"Let me break down," Jennifer Kaberi wrote in a tweet to the newspaper, "a friend of mine is at this hour (midnight) looking for her nephew who works in that building... Imagine she sees those photos."
The Media Council of Kenya advises "publication of photographs showing mutilated bodies, bloody incidents and abhorrent scenes shall be avoided" unless in the public interest.
Newspapers sometimes argue a graphic image is needed to expose the realities of war, or terror, or - in the case of a little boy lying dead on a beach - highlight the plight of a people trying desperately to reach safety.
The New York Times argued it did have a justification in printing the pictures.
The approach, the statement concluded, was used "wherever in the world something like this happens" but, Kenyans argued, most of the time that was not the case with US victims and photographs of African victims were more commonplace.
"African victims of atrocities such as yesterday often get their death displayed for consumption with little to no regard for their privacy or the grief of their family members," James Siguru Wahutu, a fellow at BKC Harvard who studies media and mass atrocities, said.
We have heard from some readers upset with our publishing a photo showing victims after a brutal attack in Nairobi. We understand how painful this coverage can be, and we try to be very sensitive in how we handle both words and images in these situations. https://t.co/Qjm0qBMaF3 pic.twitter.com/1sqgTnnVKW— The New York Times (@nytimes) January 15, 2019
Joseph Kariuki, former digital editor of Kenyan newspaper The Star, has also made the decision to publish distressing images in the past - even when he knew there was likely to be a public backlash.
On one occasion, it meant showing a picture of a mother who had been killed with her baby strapped to her back during ethnic clashes in the east of the country.
"That week over a hundred people had been killed and then that picture of the mother and her baby surfaced," he recalled.
"We had to show the public what was happening."
It had results, he said, in so far as "for the first time, the president spoke about the clashes and ordered more boots on the ground".
But publishing the images from the attack in Nairobi, he argued, had no such public interest defence, showing the impact or frequency of the attacks.
"In my view, they were not justified to use those pictures considering the last time we had a terror attack was more than two years ago and the impact is much less compared to Garissa University attack [where 148 people died] or Westgate [Mall attack, where 67 died]."
- BBC / Reuters