Three gunmen have been killed at Burkina Faso's army headquarters, said Defence Minister Jean Claude Bouda on Friday. Four others were "neutralised" at the French embassy, according to a government statement.
It came after reports that an explosion had rocked the building in the country's capital, Ouagadougou.
France's embassy, located around one kilometre away, also said it was under attack and urged its citizens to stay hidden.
"Attack underway at the French Embassy and French Institute. Stay hidden where you are," it said in a Facebook post.
An aide to France's Foreign Minister Jean-Yves le Drian later said France's embassy and cultural institute Burkina Faso capital were no longer in danger.
A witness told Euronews the explosion at the army headquarters was "was very strong" and shook his building which is located one kilometre away.
Black smoke could be seen billowing above the building.
The cause of the blast was not immediately clear.
Witnesses told the French news agency five armed men emerged from a car and opened fire on passers-by before heading for the embassy.
France's ambassador to Burkina Faso Xavier Lapdecab wrote on Twitter that there was an "attack in progress in Ouagadougou," and called for "all compatriots to exercise absolute caution and stay in a safe place".
The country's director general said Ouagadougou was being attacked by suspected Islamic extremists.
There was no immediate word on civilian casualties.