To add, the ship probably has a phosphor bronze prop and in salt water (indeed even in fresh water to a lesser extent) this would all react with the metal of the hull so the sacrificial anodes are added to corrode first and protect the ship. Harbours also have a lot of free electrical leaks into the water (true) which accelerates the process. Basically the different metals act like a battery with the salt water being the medium.
Whilst a fibreglass hull, my friends yacht has a couple of these to protect the propeller, shaft, bearings and hull fittings.
Cheers
Geoff