At one stage, non-armed-forces vessels were being permitted to carry semi- and automatic weapons under very stringent controls. If you imagine those locks on the duty-free drinks trolley on a plane, and upscale it: they could unlock the weapons in defined areas and were permitted to use force to repel attack from unidentified craft.
That obviously invites an arms race with pirates, and probably reduces survivability of the crews. That's why I asked about a different solution - where merchant crews are unarmed, but armed forces provide separate, rapid response service with overwhelming force.
https://www.telegraph.co.uk/news/worldnews/piracy/8858159/Ar...