Islamic extremists have killed at least seven soldiers in Burkina Faso’s capital after opening fire on the French embassy and army headquarters in separate attacks.

Eight of the militants were also killed during the attacks in Ouagadougou, a government official said.

Several other people were wounded among the security forces, and it is feared the death toll could rise, communications minister Remy Danjuinou added.

Five emergency centres have been set up in Ouagadougou to treat the high number of casualties in the former French colony.

Troops ride in a vehicle near the French embassy in central Ouagadougou (AP)

It is not clear if more militants were involved in the violence, which was called a terrorist attack by Jean Bosco Kienou, director general of Burkina Faso’s police, and French prime minister Edouard Philippe. There has been no claim of responsibility.

Gunfire and explosions resounded for hours but had subsided by midday. Workers fled offices near the site of the violence, and helicopters were seen above the embassy.

Defence and security forces responded to the attacks, police said, and barricades were set up.

Witnesses at the state television offices that face the embassy said five attackers arrived in a pickup truck and started shooting after shouting: “Allahu Akhbar.” They then set fire to the truck and continued shooting.

The area also houses other embassies, the prime minister’s office and UN premises.

Eight militants were killed during the assault (AP)

Across central Ouagadougou to the west, heavy smoke rose from the army joint chief of staff’s office, where witnesses reported loud explosions.

The assailants there also arrived in a pickup and starting shooting at soldiers, said Moussa Korbeogo, a trader at a nearby market.

“Some of the soldiers ran into a nearby bank to seek shelter. Several were killed outside and inside the premises,” Mr Korbeogo said.

Five of the extremists were killed at the embassy and at least three were killed near the army headquarters, officials said.

French Foreign Minister Jean-Yves Le Drian said Burkina Faso’s security forces had been mobilised with the support of the French to “reduce the threat”.

Burkina Faso, a landlocked nation in West Africa, is one of the poorest countries in the world. It shares a northern border with Mali, which has long battled Islamic extremists.

Ouagadougou has been attacked by Islamic extremists targeting foreigners at least twice in the past few years. In August, extremists opened fire as patrons dined at a restaurant, killing at least 18 people. In January 2016, Islamic extremists attacked another cafe popular with foreigners, killing 30 people. Security forces struggled to contain the attacks.