Abstract: We consider a non-Markovian discrete-time random walk on Z with unbounded memory called the elephant random walk (ERW). We prove a strong invariance principle for the ERW. More specifically, we prove that, under a suitable scaling and in the diffusive regime as well as at the critical value pc=3/4 where the model is marginally superdiffusive, the ERW is almost surely well approximated by a Brownian motion. As a by-product of our result we get the law of iterated logarithm and the central limit theorem for the ERW.