The coordinated attacks in Ouagadougou, which coincided with a meeting of regional anti-jihadist forces, underlined the struggle the fragile West African nation faces in containing a bloody and growing jihadist insurgency.
Eight armed forces personnel were killed, the government said, while a French security source said 12 more were seriously injured. Earlier security sources had reported that the death toll was at least 28.
There was no immediate claim of responsibility, and while a jihadist plot is the most likely, the government was not ruling out the involvement of plotters behind a failed coup in 2015.
"This is a terrorist attack, linked to a current or another terrorist movement in the Sahel... or to others who want to are destabilise or block our democratic progress," said communication minister Remis Fulgance Dandjinou on Saturday morning.
Two people were arrested near the headquarters, a security source told AFP.
The government said the attack on the military HQ was a suicide car bombing and that the G5 Sahel regional anti terrorism force may have been the target.
"The vehicle was packed with explosives" and caused "huge damage", Security Minister Clement Sawadogo said.
Officials from Burkina Faso, Chad, Mali, Mauritania and Niger were at the meeting, representing the nations who have launched a joint military force to combat jihadists on the southern rim of the Sahara.
President Roch Marc Christian Kabore said in a statement: "Our country was once again the target of dark forces."
Terror in broad daylight
The violence began mid-morning when heavy gunfire broke out in the centre of the Burkinabe capital. Witnesses said five armed men got out of a car and opened fire on passersby before heading towards the French embassy. The embassy attackers were armed with Kalashnikov assault rifles and were "dressed in civilian clothes" with their faces uncovered, witnessed said.
At the same time, the bomb went off near the headquarters of the Burkinabe armed forces and the French cultural centre, about a kilometre from the site of the first attack, other witnesses said.
A gunman who attacked the military HQ was wearing the uniform of the national army, according to a security source.
Four attackers were shot outside the French embassy and another four at the military HQ, another security source told AFP.
Paul Koalaga, a security consultant in Burkina Faso, said the attacks involved a "crescendo".
"After soft targets, such as hotels and restaurants, this attack aimed at hard targets, strong symbols," he said, adding there appeared to be "a problem at the intelligence level."
The Ouagadougou prosecutor's office appealed for witnesses "to assist in the search and identification of accomplices, hosts and any possible facilitators" of the events.
Condolences and condemnation
The G5 meeting was supposed to have been held at the headquarters but had been moved to another room, Sawadogo said.
"Perhaps it was the target. We do not know at the moment. In any case the room was literally destroyed by the explosion," the minister added.
The G5 Sahel's completed force will be composed of 5,000 troops and aims to be fully operational by the end of the month. It has already carried out operations against jihadist fighters with help from the French army.
Mahamadou Issoufou, Niger's president and the current chair of the group, said Friday's attacks "will only strengthen the resolve of the G5-Sahel and its allies in the fight against terrorism".
French President Emmanuel Macron offered his condolences, Turkey's Recep Tayyip Erdogan, who is on a visit to neighbouring Mali, "strongly condemned" the attack while UN chief Antonio Guterres called for an "urgent and concerted effort" to improve stability in the Sahel.
The insurgency in the region has caused thousands of deaths, prompted tens of thousands to flee their homes and dealt crippling blows to economies that are already among the poorest in the world.
Burkina Faso has been the target of jihadist attacks since 2015, and this is the third time in two years that Ouagadougou is the target of jihadist attacks targeting places frequented by Westerners.
On August 13th last year, two assailants opened fire on a restaurant on the capital's main avenue, killing 19 people and wounding 21. No one has so far claimed responsibility for that attack.
On January 15th, 2016, 30 people -- including six Canadians and five Europeans -- were killed in a jihadist attack on a hotel and restaurant in the city centre.
That attack was claimed by the Al-Qaeda-linked Al-Murabitoun group, which was led by the one-eyed Algerian jihadist Mokhtar Belmokhtar.
A group called Al-Qaeda in the Islamic Maghreb (AQIM) also said some of its militants were involved.
Editor's note: This article has been updated to reflect the revised death toll provided by authorities.