Around 80 percent of Benin's budget comes from the port of Cotonou making maritime security crucial for the nation's wealth
The naval patrol boat Alibori braves high seas and rough weather to help prevent a repeat of that disastrous year 2011, when pirates carried out 21 attacks on shipping in Benin's waters.
The oil-rich Gulf of Guinea waters on the west African coast from Senegal to Cameroon have the highest rate of piracy in the world, ranging from armed robbery and kidnapping for ransom to the hijacking of oil tankers.
Benin is a small country with scant resources, dwarfed by neighbouring top oil producer Nigeria. Around 80 percent of Benin's budget comes from the port of Cotonou making maritime security crucial for the nation's wealth.
After the dark days of 2011, authorities took steps to halt piracy in Beninese territorial waters and since 2012, no attacks have been officially recorded.
Off the Benin coast today, there are three anchorage zones where bulk carriers, oil tankers and cargo ships are moored awaiting their turn to dock in Cotonou port or are simply passing through.
"It's our job to keep them safe," the captain of the Alibori, Jonas Noukpleguidi, says of the ships' crews.
The US-based non-profit organisation Oceans Beyond Piracy (OBP) in 2015 called the entire Gulf of Guinea "the most dangerous region for seafarers."
OBP reported that 54 attacks took place in the Gulf last year -- albeit down from 67 in 2014 -- but still "with significant human cost".
Regarding armed robberies off Nigeria alone, "OBP estimates that 160 seafarers were involved in these attacks in which many were assaulted and 13 died."
In such dangerous waters, Benin is considered a "high risk" nation by insurance companies, which consequently raise their premiums and render Cotonou more expensive for shipping companies using the port.
During a visit to the United Nations headquarters in 2011, Benin's former president Thomas Boni Yayi asked for help from the international community.
"There was clear intent on the part of the ex-head of state," says naval commander Patrice Thomas, a French officer helping in the anti-piracy fight of the onetime French colony.
"The leaders understood that security was the country's life insurance," he says.
During the pirate onslaught five years ago, Benin's navy consisted of two broken-down Chinese patrol boats and a number of smaller vessels.
Today, both Chinese boats are operational alongside three more that were ordered from France. Beijing plans to donate a third patrol boat.
The boats are at sea round the clock and relay one another regularly. "Patrol boats are fragile, we need the means to maintain them," says deputy naval chief of staff Albert Badou.
"The authorities are aware of this. We were starting to run out of spare parts but funds were released and we'll have them by December," he adds.
A second semaphore station to communicate with the vessels at sea has been built at Grand-Popo on the road to Togo, the small nation to the east of Benin. The outpost will monitor 120 kilometres (75 miles) of coastline.
Using radar and long-distance cameras provided by France and the United States, coastal watch posts are linked to a naval command centre, where an onscreen map pinpoints the positions of commercial shipping at anchorage. Another gives the identities of the vessels.
At the regional level, Benin is far from alone in the battle against piracy, but cooperation between west African countries has been problematic. Meeting in Togo in mid-October, the African Union finally adopted an agreement on piracy, illegal fishing and maritime security.
The Republic of Congo's President Denis Sassou Nguesso announced the cooperation accord as "historic" and a key to development, saying that 43 of the AU's 54 members -- 38 of which have a seacoast -- signed up.
Cotonou already hosts the Multinational Maritime Coordination Centre, which was created after a summit in Cameroon in 2013 on piracy. Eight officers from Benin, Nigeria, Niger and Togo work at the centre.
Each country can provide sea and air power, but when exercices are held, patrols do not always cooperate well.
Despite the setbacks and though a maritime prefecture set up last year to centralise operations at sea still has no electricity, Benin is frequently held up as a model in combatting piracy.
"I remember that in 2011, I said 'thanks to the pirates for waking up our politicians'," says the maritime prefect Maxime Ahoyo, a former chief of naval staff.
"They understood that the sea is wealth. It should become a driver for development."