A Hamiltonian formulation is constructed for a finite ion Larmor radius fluid model describing ion temperature-gradient driven and drift Kelvin-Helmholtz modes. The Hamiltonian formulation reveals the existence of three invariants obeying detailed conservation properties, corresponding roughly to generalized potential vorticity, internal energy and ion momentum parallel to the magnetic field. These three invariants are added to the energy to form a variational principle that describes coherent structures (CSs), such as monopolar and dipolar vortices or modons. It is suggested that the invariants are responsible for the coherence and longevity of CSs and for their robustness during binary collisions.