Gunmen affiliated to al-Qaeda have killed 16 people, including four Europeans, in an attack on a beach resort in Ivory Coast on Sunday.

Six militants from the al-Qaeda in the Islamic Maghreb attacked beach goers in a resort at Grand Bassam, about 40 km east of the commercial capital Abidjan.

The victims included 14 civilians and two soldiers, while the four attackers were also killed in clashes with Ivorian security forces.

"Six attackers came onto the beach in Bassam this afternoon. We have 14 civilians and two special forces soldiers who were unfortunately killed," Ivorian President Alassane Ouattara said, according to Reuters.

Al-Qaeda in the Islamic Maghreb, which has carried out deadly hotel attacks in West Africa before, including in Mali and Burkina Faso, claimed the attack.

Witnesses said the gunmen first shot randomly at swimmers and sunbathers before entering the resort premises at lunch time.

"They started shooting and everyone just started running. There were women and children running and hiding. It started on the beach. Whoever they saw, they shot at," a witness told Reuters.