Over 20 people are killed and an unknown number of hostages taken in an attack on a restaurant and hotel in Ouagadougou, the capital of Burkina Faso.

At least 126 hostages, including a government minister, have been freed and three gunmen have been killed, the Associated Press news agency reported on Saturday, quoting a government official.

A senior security official said that armed fighters have rigged with explosives the upper floors of the Splendid Hotel they seized on Friday, slowing the progress of United States and French-assisted Burkinabe security forces seeking to retake it.

"What's making our job more difficult is that they've rigged the access to the upper floors," the Burkinabe officer, who asked not to be named, told Reuters.

Security forces in the early hours of Saturday began an assault to reclaim the besieged hotel and entered its lobby, part of which was on fire, witnesses said.

Diallo Ismael, a human rights activist, said that about 300 people could be inside the hotel popular with foreigners.

The interior ministry said that the fire brigade has found around 10 bodies on the terrace of the restaurant opposite of the hotel.

Earlier, Olympia de Maismont, a local reporter, told Al Jazeera that police confirmed that there were hostages in the Splendid Hotel, and she said the military had surrounded the building following reports of gunfire and explosions.

The attack, she added, happened around 8pm local time (20:00 GMT) on Friday.

Reuters reported that gunmen stormed the hotel, burning cars outside and firing into the air to drive back crowds before security forces arrived, prompting an intense exchange of gunfire.

Al-Qaeda in the Islamic Maghreb claimed responsibility for the attack, SITE Intelligence Group, a monitoring organisation, reported.

Splendid Hotel, a four-star residence near the airport, is known to be popular with foreigners, including UN staff.

This is the first time gunmen have carried out an assault in the capital of Burkina Faso.

In November, gunmen stormed the Radisson Blu hotel in the Malian capital, Bamako, and took at least 170 people hostage.

After a nine-hour standoff with Malian and UN soldiers, most of the hostages were released - but 19 were killed. Two attackers were also killed.

Burkina Faso elected Roch Marc Christian Kabore as its new president in a historic vote in November, becoming the West African country's first new leader in decades.

Kabore's win marked the end of a transitional period after the overthrow of the country's longtime ruler, Blaise Compaore, in 2014 and a failed coup attempt in September.