ABIDJAN (Reuters) - Al Qaeda’s North African branch said its attack on a beach resort in Ivory Coast on Sunday that killed 18 people was revenge for a French offensive against Islamist militants in the Sahel region and called for its forces to withdraw.

Soldiers stand guard on the beach following an attack by gunmen from al Qaeda's North African, in Grand Bassam, Ivory Coast, March 14, 2016. REUTERS/Luc Gnago

The raid in Grand Bassam claimed by Al Qaeda in the Islamic Maghreb was the first of its kind in Ivory Coast but the third in the region since November.

It was also a setback for France, who lost four of its nationals when gunmen opened fire on people eating lunch at restaurants and sunning themselves on the sand.

“We repeat our call to all countries involved in the French invasion of Mali to withdraw,” the group said in a statement.

It named the attackers but gave no further details of their identities.

France is a key player in security in West Africa with about 3,500 troops in the region. It has also joined a campaign against Islamic State, which is based in Iraq and Syria.

Paris is to station a force of armed gendarmes in the capital of Burkina Faso to react swiftly in the event of another attack in the region and to provide training, French Interior Minister Bernard Cazeneuve said on Tuesday.

“The desire to position this (gendarmerie) team in Ouagadougou is to enable us to immediately dispense advice and coordinate other actions in the event of a terrorist crisis,” Cazeneuve said.

He was speaking during a visit with Foreign Minister Jean-Marc Ayrault to Ivory Coast that aims to reassure the large French community and boost the investigation into the attack in Grand Bassam.

France launched Operation Serval to oust militants from northern Mali and replaced it in 2014 with Operation Barkhane which targets militants across the Sahel region.

Ayrault and Cazeneuve met President Alassane Ouattara and were due to visit the site of the attack and meet representatives of the French community.

Islamic State has also singled out France as a target and claimed responsibility for the attack in Paris in November in which 130 people were killed.

Twenty people were killed at a hotel in Mali in November and 30 died in an attack on a cafe and hotel in Burkina Faso in January.

Ivory Coast has French-speaking West Africa’s largest economy and has recovered from a decade of political crisis to boast one of the world’s fastest-growing economies.