The Siege at the Radisson Blu hotel by Islamist militants ended on Friday after Malian commandos stormed the building and rescued 170 people, many of them foreigners, but 27 people died in the attack and the crossfire (See: Three killed as gunmen seize 170 hostages at Radisson Blu hotel in Mali capital).
President Ibrahim Boubacar Keita announced the death toll and said seven people were wounded in the attack, which has been claimed by jihadist group Al Mourabitoun and al Qaeda in the Islamic Maghreb (AQIM).
"Tonight the death toll is heavy," Keita said on state television, declaring a 10-day state of emergency and three days of national mourning. He said two militants also died.
Friday's assault on the Radisson Blu hotel, which comes after the deadly attack in Paris that killed 130, is yet another setback for former colonial power France, which has stationed 3,500 troops in northern Mali to try to restore stability after a rebellion in 2012 by ethnic Tuaregs that was later hijacked by jihadists linked to al Qaeda.
Minister of internal security Colonel Salif Traoré said the gunmen burst through a hotel security barrier at 7 am (0700 GMT), spraying the area with gunfire and shouting "Allahu Akbar", or "God is great" in Arabic.
The attack ended around 4 pm and a UN official said UN peacekeepers searching the hotel made a preliminary count of 27 bodies.
As troops stormed the hotel, state television showed them brandishing AK47s in the lobby. A body lay under a brown blanket at the bottom of a flight of stairs.
Peacekeepers saw 12 dead bodies in the basement and another 15 on the second floor, Reuters quoted an unnamed UN official as saying, who also said that UN troops were helping Malian authorities search the hotel.
Some people were freed by the attackers after showing they could recite verses from the Koran, while others managed to escape or were brought out by security forces.
One of the rescued hostages, celebrated Guinean singer Sékouba "Bambino" Diabate, said he had overheard two of the assailants speaking English as they searched an adjacent room.
The raid on the hotel, which lies just west of the city centre near government ministries and diplomatic offices, came a week after Islamic State militants killed 130 people in Paris.
Twelve Air France flight crew members were in the hotel but all were brought out safely, the French national carrier said.
A Turkish official said five of seven Turkish Airlines staff had also managed to flee. The Chinese state news agency Xinhua said three Chinese citizens had been killed in the attack.
Malian President Ibrahim Boubacar Keita cut short a trip to a regional summit in Chad, his office said.
Northern Mali was occupied by Islamist fighters, some with links to al Qaeda, for most of 2012. They were driven out by a French-led military operation, but violence has continued in Bamako and central Mali on the southern reaches of the Sahara.
One security source said as many as 10 gunmen had stormed the building, although the company that runs the hotel, Rezidor Group, said it understood there were only two attackers.
Al Mourabitoun has claimed responsibility for a number of attacks, including an assault on a hotel in the town of Sevare, 600 km (375 miles) northeast of Bamako, in August in which 17 people including five UN staff were killed.