While the crew escaped unhurt, the attack raises once again the question of whether Swedish ships should be able to arm themselves in the battle against pirates.
"Had you asked me a year ago I would have been a staunch opponent against having armed guards, but today I am much more hesitant," said Jonas Engström, security manager at shipping firm Wisby Ship Management, to news agency TT.
Shortly after 3am on Sunday morning, he received a call from the crew of the tanker Gotland Sofia.
Around ten pirates had boarded the ship while the crew unloaded the cargo of oil to an adjacent vessel, 70 kilometres outside the port of Cotonou in Benin.
The crew, consisting of four Swedes, 18 Filipinos and a Ukrainian, proceeded to lock themselves in. The pirates tried to get into where the crew had blockaded themselves, but fled when units from Benin's navy fleet approached.
"In this case, nothing happened, but a lot of people become anxious. It is a situation that may involve substantial risks."
The government is current investigating the question of whether Swedish shipping companies should be allowed to have armed guards on board their ships. But pending the outcome of the investigation, many companies have already begun to employ guards.
"We will certainly look at it now," Jonas Engström said.