Metals enter aqueous solution and are oxidized.
Oxidation reaction (pH independent):
Reduction reaction in acid solution:
Reduction reaction in neutral or slightly alkaline solution:
In a neutral or slightly alkaline solution, the protons of water are reduced into molecular hydrogen giving rise to the production of hydroxide ions responsible of the precipitation of the slightly soluble ferrous hydroxide (Fe(OH)2).
This finally leads to the global reaction of the anaerobic corrosion of iron in water:
Transformation of ferrous hydroxide into magnetite 
- 3 Fe(OH)2 → Fe3O4 + H2 + 2 H2O
- ferrous hydroxide → magnetite + hydrogen + water
The well crystallized magnetite (Fe3O4) is thermodynamically more stable than the ferrous hydroxide (Fe(OH)2 ).