Loss of stability in Hamiltonian systems that depend on parameters