All remaining hostages in the siege in Bamako, Mali, are now safe and out of the Radisson Blu hotel where they had been held, ministerial adviser Amadou Sangho told French television station BFMTV.
"These people have been taken under the wing of the civil authorities," he said.
27 people have been killed in the attack, siege and subsequent assault, according to several media reports from Bamako.
Islamist militant group al Mourabitoun said it was jointly responsible with al Qaeda in the Islamic Maghreb (AQIM) for the attack, according to Mauritania's Alakhbar news agency.
Earlier, Malian commandos stormed the luxury hotel after Islamist gunmen took 170 people, including many foreigners, hostage in the capital city of the former French colony, which has been battling rebels allied to al Qaeda for several years.
Gunmen dug in on the seventh floor of the hotel as special forces advanced on them.
Six US citizens were among the people who were rescued, a US military spokesman said. Twelve Air France flight crew were in the building but all were extracted safely, the French national carrier said.
Turkish Airlines staff and Chinese tourists were among others taken hostage.
Mali has been battling rebels allied to al Qaeda for several years.
The raid on the hotel, which lies just west of the city center near government ministries and diplomatic offices, came a week after Islamic State militants killed 129 people in Paris, raising fears French nationals were being specifically targeted.
Occasional bursts of gunfire were heard as the assailants went through the seven-storey building, room-by-room and floor-by-floor, one senior security source and a witness told Reuters.
State television broadcast some footage of the operation.
Some people were freed by the attackers after showing they could recite verses from the Koran, while others were brought out by security forces or managed to escape under their own power.
One of the freed hostages said that he heard the attackers speaking English in the next room. "I heard them say in English 'Did you load it?', 'Let's go'," the famous Guinean singer Sékouba 'Bambino' Diabate, who was freed by the security forces, told Reuters. "I wasn't able to see them because in these kinds of situations it's hard."
"We saw two of the attackers. One was wearing a balaclava. The other was black-skinned. They forced [through] the first barrier" protecting the hotel, head of security Seydou Dembele told Reuters. Two security guards were shot in the legs in the early stages of the assault.
Northern Mali was occupied by Islamist fighters, some with links to al Qaeda, for most of 2012. Although they were driven out by a French-led military operation, sporadic violence has continued.
The security source said as many as 10 gunmen had stormed the building, firing shots and shouting "Allahu Akbar," or "God is great" in Arabic. The Chinese state news agency Xinhua said several Chinese tourists were among those trapped inside the building.
An Islamist group claimed responsibility for the death of five people last March in an attack on a restaurant in Bamako that is popular with foreigners.
Follow VICE News on Twitter: @vicenews