More than 100 hostages have been freed after suspected Islamist gunmen stormed a hotel in Mali's capital Bamako, killing at least 19 people.
The Radisson Blu Hotel was stormed by special forces after gunmen entered it and seized 170 people.
At least 130 of the 170 people in the building have been safely accounted for.
Al-Qaeda in the Islamic Maghreb and its offshoot al-Murabitoun said they carried out the attack, according to an agency used by jihadists in the region.
Speaking after a crisis cabinet meeting late on Friday (local time), Malian President Ibrahim Boubacar Keita announced a state of emergency from midnight on Friday for 10 days, as well as three days of national mourning.
He said 21 people were killed in the attack, including two gunmen.
Earlier reports said at least 27 people had died. A UN official who spoke on condition of anonymity said 12 bodies were found in the basement and 15 on the second floor.
Special forces spent several hours chasing the attackers on the upper floors of the hotel. The US said the attack had ended. There was no confirmation from the Malian authorities.
One of those killed was Geoffrey Dieudonne, a member of parliament in Belgium's Wallonia region.
A journalist in the lobby of the hotel said hostages were leaving the hotel. It was not clear how many survived.
Some of the hostages rescued from the building had been wounded.
The US-owned hotel is popular with foreign businesses and airline crews.
Eyewitnesses said the gunmen had entered the hotel shooting "God is great!" in Arabic.
Before special forces stormed the building, a security source said some hostages who were able to recite verses of the Koran were being freed.
A famous Guinean singer who was taken hostage and escaped said he heard attackers in the next room speaking English.
"I heard them say in English 'Did you load it?', 'Let's go'," singer Sékouba 'Bambino' Diabate, who was freed by Malian security forces, said.
"I wasn't able to see them because in these kinds of situations it's hard."
Mali's presidency has tweeted (in French) thanking the security forces and friendly countries for their support in responding to the attacks.
US special forces had helped in the hostage rescue operation. French special forces were also dispatched to the scene.
Malian security forces have been working their way up the building to where the gunmen were reportedly entrenched.
There is as yet no established link with the attacks in Paris one week ago that killed 130 people.
In August, suspected Islamist gunmen killed 13 people, including five UN workers, during a hostage siege at a hotel in the central Malian town of Sevare.
France, the former colonial power in Mali, intervened in the country in January 2013 when al-Qaeda-linked militants threatened to march on Bamako after taking control of the north of the country.
Mali's President Ibrahim Boubacar Keita has cut short a trip to a regional summit in Chad.
His French counterpart Francois Hollande said: "We should yet again stand firm and show our solidarity with a friendly country, Mali."
The UN force in Mali took over responsibility for security in the country from French and African troops in July 2013, after the main towns in the north had been recaptured from the Islamist militants.