First integrals and stability properties