Somali pirates unsuccessfully attacked the Maersk Alabama off the Kenyan coast, Wednesday, for the second time in seven months.
The European Union Naval Force said pirates fired automatic weapons at the ship, but guards on board thwarted the attack by firing back.
Vice Adm. Bill Gortney of the U.S. Naval Forces Central Command, said the Maersk Alabama followed the right security procedures on board.
"This is a great example of how merchant mariners can take proactive action to prevent being attacked and why we recommend that ships follow industry best practices if they're in high-risk areas," Gortney said in a statement.
Cmdr. John Harbour, a spokesman for the EU Naval Force said it is just pure chance the Maersk Alabama was attacked a second time, and that all ships sailing off East Africa face the risk of pirate attacks.
"It's not the first vessel to have been attacked twice, and it's a chance that every single ship takes as it passes through the area," he said. "At least this time they had a vessel protection detachment on board who were able to repel the attack."
The Maersk Alabama was attacked in April 2009 when the ship's captain Richard Phillips was held captive for five days. Since then, owners of the vessel have implemented safety equipment on board, including a security force of "highly trained ex-military personnel" with defense weapons.