# Metal and reactions with different temperatures of water

I knew that in warm water magnesium forms $\ce{Mg(OH)2}$ and $\ce{H}$ gas, and in steam it forms $\ce{MgO}$ and $\ce{H}$ gas (this is also the case for metals lower down the electrochemical table). However I came to realize that for those higher than magnesium all form metal hydroxide when react with water. What is the mechanism for such a reaction?

$\ce{Mg + 2 H_2O \rightarrow Mg(OH)_2 + 2 H_2}$
$\ce{Mg(OH)_2 \rightarrow MgO + H_2O}$