  The main purpose of this paper is to prove the mean ergodic theorem for
nonexpansive mappings and semigroups in locally compact Hadamard spaces,
including finite dimensional Hadamard manifolds. The main tool for proving
ergodic convergence is the almost periodicity of orbits of a nonexpansive
mapping. Therefore, in the first part of the paper, we study almost periodicity
(and as a special case, periodicity) in metric and Hadamard spaces. Then, we
prove a mean ergodic theorem for nonexpansive mappings and continuous
semigroups of contractions in locally compact Hadamard spaces. Finally, an
application to the asymptotic behavior of the first order evolution equation
associated to the monotone vector field on Hadamard manifolds is presented.
