Special forces troops freed around 150 hostages on Saturday and retook a hotel in Burkina Faso's capital Ouagadougou that was seized by al Qaeda fighters the day before, but the attack killed at least two dozen people from 18 countries.
The assault, claimed by al Qaeda in the Islamic Maghreb (AQIM), began at 8:30pm local time on Friday, when the area around the Splendid Hotel is typically packed with crowds. The attackers torched cars and fired in the air to drive people back from the building, before entering the hotel and taking hostages.
A doctor who treated some of those wounded in the initial attack said they had told him that the attackers appeared to target Westerners.
Burkina Faso security forces, assisted by French and US military personnel, began the assault to reclaim the hotel in the early hours of Saturday, entering its lobby, part of which was on fire.
Gabriel Mueller, an Austrian aid worker staying at a different hotel, described the early scenes around the hotel as a "complete bloodbath."
"A slight sense of safety is spreading. We can see the snipers from France and the USA, who are getting into position," he told Austria's Salzburger Nachrichten newspaper via text message.
France normally has up to 200 special forces troops in the country as part of a regional anti-militant operation.
Progress through the 146-room establishment was slowed by explosives planted by the militants.
"What's making our job more difficult is that they've rigged the access to the upper floors," said a senior Burkinabe gendarme officer, who asked not to be named.
Burkina Faso's President Roch Marc Christian Kabore said 23 people from 18 different nationalities were killed in the assault on the Splendid Hotel and a nearby casino popular with Westerners and French soldiers based in Burkina Faso. The authorities gave no further details of the victims.
Burkinabe authorities said that around 33 people had been injured and that four assailants, including an "Arab" and two "black Africans," were killed.
French ambassador Gilles Thibault put the death toll at 27 and said on Twitter that around 150 hostages had been freed during an operation that received support from French and US forces.
A witness told Reuters that major clashes ended after a period of sustained gunfire and explosions that appeared to focus on the Restaurant Cappuccino, located opposite the Splendid Hotel, early on Saturday.
Sporadic gunfire continued throughout the morning however, and the final assailant was killed later in another nearby hotel, the Hotel Yibi, officials said.
Until Friday's attacks, the landlocked West African nation, an ally of Western governments against jihadist groups in the arid reaches of the southern Sahara, had largely been spared the kinds of attacks that have plagued its neighbors.
The assault follows a similar raid in November on a luxury hotel in Mali's capital Bamako which killed 20 people, including citizens of Russia, China and the United States.
The Ouagadougou assault signaled an expansion of operations for Islamist militants who are forging new alliances and stepping up their activities, echoing the growth of Islamic State in the Middle East.
"The situation we're experiencing since yesterday in Burkina Faso is unprecedented," Kabore said when he visited the scene of the attack. "These are vile, cowardly acts and the victims are innocent people"
"We call upon the Burkinabe people to be vigilant and courageous because we must include terrorist acts as an integral part of our daily struggle," the president said.
Meanwhile, an Austrian doctor and his wife were kidnapped overnight in the north near the border with Mali, the Security Ministry said.
The kidnapping occurred in the Baraboule area, and it was not immediately clear whether it was linked to the hotel attack.
Follow VICE News on Twitter: @vicenews