Kenyan President Uhuru Kenyatta has said a siege by suspected militants in Nairobi is over and all the attackers have been "eliminated".
Gunmen attacked the compound in the Westlands district of Kenya's capital on Tuesday, killing at least 14 people.
Officials originally announced the end of the siege hours after it began, but gunfire and explosions were heard again early on Wednesday.
The Somalia-based militant group al-Shabab said it was behind the attack.
It is not clear how many attackers there were.
The complex houses the DusitD2 hotel as well as offices.
In a TV address to the nation, Mr Kenyatta said 14 people had been killed but 700 others were safely evacuated from the complex.
However, the Kenyan Red Cross put the number of dead at 24.
A US citizen is among the dead, the US state department said. He has been named as Jason Spindler.
A British citizen with dual South African nationality was also killed and another Briton was wounded, the UK Foreign Office said.
Skip Twitter post by @UKinKenya
End of Twitter post by @UKinKenya
"I can now confirm that... the security operation at Dusit is over and all terrorists have been eliminated," the Kenyan president said.
"We will seek out every person that was involved in the funding, planning and execution of this heinous act," he added, vowing to pursue them "relentlessly".
"We are a country governed by laws, rules and regulations - a country that embraces peaceful coexistence... I must also state that we are also a nation that never forgets those who hurt our children."
A stark reminder of al-Shabab
By Andrew Harding, BBC News, Nairobi
After 19 hours of terror, gunfire, bloodshed and inevitable confusion, the siege at an upmarket hotel and business complex in the hills west of Nairobi's central business district ended abruptly on Wednesday morning.
Throughout the night, cowering groups of civilians - many had spent hours hiding in their offices or in bathrooms - were escorted to safety by security forces amid sporadic bursts of gunfire and the boom of explosions that continued well beyond dawn.
On the crowded street outside the large, upmarket complex, friends and relatives embraced those who emerged and thanked Kenyan security forces. A fleet of ambulances stood ready to take the wounded to hospital.
Kenya's vital but precarious tourism industry has been badly damaged by past terrorist attacks - not least Westgate and the 2015 attack on a university campus in Garissa - and by negative travel advice issued by foreign governments. Today President Kenyatta was quick to "assure every Kenyan and foreign visitor that you are safe".
But this attack is a stark reminder that al-Shabab remains a powerful force, with the capacity to launch a sophisticated attack on a well-guarded target in a neighbouring country.
How did the attack unfold?
The attack began at about 15:00 local time (12:00 GMT) when four gunmen threw bombs at vehicles in the car park before entering the lobby, where one blew himself up, police say.
The attackers, two of which are shown here, were caught on CCTV as they entered the complex
A woman working in a neighbouring building told Reuters news agency: "I just started hearing gunshots, and then started seeing people running away raising their hands up and some were entering the bank to hide for their lives."
Security camera footage showed at least four heavily armed men walking in and opening fire. There are reports they had been seen visiting the compound in recent days.
Skip Twitter post by @Nairobi_News
End of Twitter post by @Nairobi_News
At 23:00, Interior Cabinet Secretary Fred Matiang'i said all the buildings in the complex had been secured by security forces.
"The situation is under control and the country is safe," he told reporters. "Terrorism will never defeat us."
But just an hour later gunfire and sporadic explosions were reported in the area. There was more heavy gunfire at about 07:00.
Security forces combed their way through the building where frightened workers had barricaded themselves inside.
In the early hours of Wednesday, more than 100 people were rescued. About 30 people are being treated at Nairobi hospitals, media reports say.
The five-star DusitD2 hotel has 101 rooms. Located in the Westlands suburb, minutes from the capital's business district, it has its own spa and several restaurants.
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.
How did those caught inside fare?
When the gunmen first entered the complex there was confusion, as people first tried to escape to freedom and then retreated into the building as they came under fire.
One eyewitness, Faith Chepchirchir, told Reuters: "People were trying to run towards the gate, but then I saw everyone who was running towards the gate was coming back from the gate, now heading to this opposite direction.
Many civilians were trapped in the complex for several hours
"So for me we just closed the doors and then gunshots were just being sprayed all over. From the top, I think [the gunmen] went to the top floor and then started spraying bullets."
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.
Some were able to keep in contact with loved ones by text.
They included Zinzi Khalwale, daughter of a former senator Boni Khalwale. Her father told The Daily Nation she had hidden in one of the rooms of her office until her rescue.
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.
Who are al-Shabab?
They are a militant Islamist group that opposes the Somali government but has also carried out attacks throughout East Africa.
Latest Stories
-
CCTV nabs driver who stole mobile phones from journalist and others
47 minutes -
Western region NDC congratulates Joseph Nelson and Emelia Arthur on ministerial nominations
60 minutes -
ECG requires ₵600 million monthly to operate efficiently – Former MD
1 hour -
Bulk oil importers assure of enough fuel to meet local demand; rules out any shortage
1 hour -
MMDCE positions: 287 submit names in Volta region, vetting starts on January 21
1 hour -
Former chief of Akrafo Kokobeng shot dead by unknown assailant
2 hours -
Under-declaration isn’t a criminal offence – Former ECG MD responds to audit report
2 hours -
ACEP calls for a change petroleum margins into tax revenues
2 hours -
Mahama appoints Mohammed Abdul-Salam as Ag. CEO of NLA
2 hours -
Let’s rewrite the history of Ghana’s youth together – Opare Addo on ministerial nomination
2 hours -
Cocoa smuggling: Cocobod intercepts 1,473 maxi bags, calls for stiffer punishment
2 hours -
Two in police grip for suspected ritual murder in Akatsi North District
2 hours -
Outlook of Sub-Saharan African countries to be neutral in 2025 – Fitch
3 hours -
GH₵490m unaccounted for by ECG in three months – Audit report
3 hours -
ICS students use theatre to amplify call against illegal mining in Ghana
3 hours