With growing fears that the militant Islamist insurgency that has engulfed large parts of West Africa is spreading, security has been dominating the campaign trail in Benin - a once-largely peaceful nation.

Sunday's presidential election comes about four months after outgoing President Patrice Talon survived a coup attempt, when Nigeria - the regional superpower - sent warplanes to bombard mutinous soldiers who had attempted to overthrow him.

Nigeria's intervention prevented Benin from going down the path of several other regional states - including Niger, Burkina Faso and Mali - where the military seized power in recent years as disillusionment grew over the failure of civilian governments to beat back the militants allied with al-Qaeda or the Islamic State (IS) group.

The threat posed to Benin by the insurgents was highlighted by the fact that an al-Qaeda affiliate, known by the initials JNIM, killed 15 soldiers last month in an attack on a military base in Kofouno, near the border with Niger.

It signalled the continuation of a trend witnessed last year, when 28 of Benin's soldiers were killed in January in an attack in the W National Park, which stretches into Niger and Burkina Faso, and another 54 three months later in the same park - making it the highest death toll suffered by the military at the hands of the insurgents.