Many of the 170 hostages initially trapped by the suspected Islamists in the besieged Radisson Blu hotel in the Malian capital Bamako were foreigners and a Belgian regional assembly official was reported to be among the dead.
About nine hours after the attack began in a hail of automatic gunfire, the country's security minister said there were no more hostages after Malian special forces backed by US and French troops stormed the building.
"They currently have no more hostages in their hands and forces are in the process of tracking them down," Security Minister Salif Traore told a news conference.
A foreign security source said 18 bodies had been recovered while a Malian military source said two attackers had been killed, but it was not clear if they were among the 18.
There was no immediate confirmation of any link to the devastating Paris attacks last Friday that left 130 people dead, but Mali has been at the centre of French military operations against Islamists in north Africa.
The country's north fell under the control of Tuareg rebels and jihadist groups linked to Al-Qaeda in mid-2012 before they were beaten back by by a French-led operation in early 2013.
The most powerful jihadist groups active in Mali are aligned with al-Qaeda rather than Islamic State, which has emerged latterly as the global leader of violent Islamic extremism.
The UN Security Council will also vote later Friday on a French-drafted resolution authorising countries to "take all necessary measures" to fight the IS group, the French mission said.
As the drama in Bamako was unfolding, EU ministers agreed at an emergency meeting in Brussels to tighten border controls after the Paris massacre which was orchestrated by a wanted Islamic State jihadist who had travelled between Syria and France.
Prosecutors in France confirmed that three people had died at a house in a suburb used as a hideout by suspected Paris attacks ringleader Abdelhamid Abaaoud, including him and his female cousin.
Abaaoud, a Belgian of Moroccan origin, and cousin Hasna Aitboulahcen were killed in an assault by anti-terror police on Wednesday. The identity of the third body has not been disclosed.
Foreign forces help in rescue -
Gunmen had entered the 190-room hotel compound in Bamako at around 0700 GMT in a car with diplomatic plates and automatic gunfire was heard from outside, security sources said.
The hotel's owner, the Rezidor Hotel Group, said 170 guests and staff were initially trapped, with employees of the French and Turkish national airlines as well as Indians and Chinese among known to be among those staying there.
President Ibrahim Boubacar Keita, who was in Chad for a summit of leaders from the Sahel region, was cutting his trip short and flying home, the presidency told AFP.
US special forces helped rescue at least six Americans from the hotel, while French paramilitary police specialised in hostage situations were also in Mali to assist.
The Radisson attack follows a siege in August lasting almost 24 hours at a hotel in the central town of Sevare in which five UN workers were killed, along with four soldiers and four attackers.
Five people, including a French citizen and a Belgian, were also killed in an attack at a restaurant in Bamako in March, in the first such incident in the capital.
Islamist groups have continued to wage attacks in Mali despite a June peace deal between former Tuareg rebels in the country's north and rival pro-government armed groups.
In a recording authenticated by Malian authorities this week, a jihadist leader in Mali denounced the peace deal and called for further attacks against France, which is helping national forces fight extremists.