  We study regular graphs whose distance-$2$ graph or distance-$1$-or-$2$ graph
is strongly regular. We provide a characterization of such graphs $\Gamma$
(among regular graphs with few distinct eigenvalues) in terms of the spectrum
and the mean number of vertices at maximal distance $d$ from every vertex,
where $d+1$ is the number of different eigenvalues of $\Gamma$. This can be
seen as a another version of the so-called spectral excess theorem, which
characterizes in a similar way those regular graphs that are distance-regular.
