  We prove that, on any closed manifold of dimension at least two with
non-trivial first Betti number, a $C^\infty$ generic Riemannian metric has
infinitely many closed geodesics, and indeed closed geodesics of arbitrarily
large length. We derive this existence result combining a theorem of Ma\~n\'e
together with the following new theorem of independent interest: the existence
of minimal closed geodesics, in the sense of Aubry-Mather theory, implies the
existence of a transverse homoclinic, and thus of a horseshoe, for the geodesic
flow of a suitable $C^\infty$-close Riemannian metric.
