  The universe is filled with a diffuse and isotropic extragalactic background
of gamma-ray radiation, containing roughly equal energy flux per decade in
photon energy between 3 MeV-100 GeV. The origin of this background is one of
the unsolved puzzles in cosmology. Less than a quarter of the gamma-ray flux
can be attributed to unresolved discrete sources, but the remainder appears to
constitute a truly diffuse background whose origin has hitherto been
mysterious. Here we show that the shock waves induced by gravity during the
formation of large-scale structure in the intergalactic medium, produce a
population of highly-relativistic electrons with a maximum Lorentz factor above
10^7. These electrons scatter a small fraction of the microwave background
photons in the present-day universe up to gamma-ray energies, thereby providing
the gamma-ray background. The predicted diffuse flux agrees with the observed
background over more than four decades in photon energy, and implies a mean
cosmological density of baryons which is consistent with Big-Bang
nucleosynthesis.
