Let Y be a CAT(0) space and G a countable group acting on Y. If the action of G does not fix a point in the boundary at infinity of Y and its rate of escape is zero, then there is a flat subspace in Y left invariant by the action of G. The key ingredient of the proof is an equivariant harmonic map from G into Y.