ON THE GULF OF OMAN—Before dawn one morning in November, four men on the deck of the MNG Resolution lifted cases of guns and body armor out of shipping containers and heaved them into a waiting speedboat.

The team zipped across the water to a tanker, where the crew pulled aside razor wire and hoisted the weapons aboard. The four men clambered up a rope ladder, and the speedboat raced back.

The 141-foot Resolution, built 30 years ago to service offshore oil platforms, has a new job: She is a floating armory and bunkhouse for contract security forces. At least a half dozen such boats ply the Gulf of Oman.

The oceangoing armories are the byproduct of global trade, high-seas piracy and national arms restrictions. Shippers traversing the dangerous waters off Somalia want armed guards to protect their cargo and crews, but most countries won’t let private security forces bring guns into their ports. So ships like the Resolution have appeared to cache weapons offshore for security companies and ferry their guns and guards to vessels needing protection.

The shipping industry once regarded armed guards on vessels as too dangerous. But a spate of Somali pirate attacks several years ago changed that thinking. Every month now, thousands of weapons pass through the Indian Ocean and hundreds of security teams rotate on and off ships in the Gulf of Oman. A similar trade goes on in the Red Sea and off Sri Lanka.