  Cosmic rays travelling through interstellar space have their propagation
directions repeatedly scattered by fluctuating interstellar magnetic fields.
The nature of this scattering is a major unsolved problem in astrophysics, one
that has resisted solution largely due to a lack of direct observational
constraints on the scattering rate. Here we show that very high-energy
$\gamma$-ray emission from the globular cluster Terzan 5, which has
unexpectedly been found to be displaced from the cluster, presents a direct
probe of this process. We show that this displacement is naturally explained by
cosmic rays accelerated in the bow shock around the cluster propagating a
finite distance before scattering processes re-orient enough of them towards
Earth to produce a detectable $\gamma$-ray signal. The angular distance between
the cluster and the signal places tight constraints on the scattering rate,
which we show are consistent with a model whereby scattering is primarily due
to excitation of magnetic waves by the cosmic rays themselves. The analysis
method we develop here will make it possible to use sources with similarly
displaced non-thermal X-ray and TeV $\gamma$-ray signals as direct probes of
cosmic ray scattering across a range of Galactic environments.
