An attack on a military patrol in northern Mali has killed four civilians and wounded 31 others, including four French soldiers, Mali's government and the French army say.

Sunday's ambush, which involved a car bomb explosion followed by gunfire, took place two days after Islamist militants killed at least six people during a raid on a military headquarters in central Mali, a country where French troops are helping combat jihadists across its vast desert reaches.

The deteriorating security situation a month ahead of a presidential election points to the difficulty international partners face restoring peace in Mali, which has become a launch pad for attacks by groups linked to al Qaeda and Islamic State across West Africa.

Photos posted on social media showed black smoke billowing from an armoured vehicle surrounded by debris on a sandy road.

"From hospital sources, the provisional record after the suicide attack against a Barkhane patrol in Gao today ... was 4 civilians dead and 31 seriously injured," Mali's Security Ministry said on Twitter.

Barkhane is the name of the near 4,000-strong French force stationed in its former colonies across the Sahel region.

French army spokesman Patrik Steiger said four French Barkhane soldiers were wounded during the explosion, which occurred close to three French vehicles. Mali's Security Ministry previously said eight French soldiers were wounded.

A spokesman for Mali's Defence Ministry, Boubacar Diallo, said a car drove into a joint Barkhane-Malian army patrol.

No one has claimed responsibility for the attack. But violence by Islamist militants has spread across the sparsely populated Sahel in recent years, slowly taking back control lost when French forces knocked back an uprising by Tuareg rebels and Islamists in 2013.

Western powers have provided funding to a regional force made up of soldiers from Mali, Niger, Burkina Faso, Chad and Mauritania combating jihadists. But the so-called G5 force has been hobbled by delays disbursing the money and poor coordination between the five countries.

French President Emmanuel Macron, who last year complained that G5 was taking too long to set up, is due in Mauritania on Monday to discuss security in the region.