Separation of variables and Hamiltonian formulation for the Ernst equation.