  One of the most important unresolved issues in gamma-ray burst physics is the
origin of the prompt gamma-ray spectrum. Its general non-thermal character and
the softness in the X-ray band remain unexplained. We tackle these issues by
performing Monte Carlo simulations of radiation-matter interactions in a
scattering dominated photon-lepton plasma. The plasma -- initially in
equilibrium -- is driven to non-equilibrium conditions by a sudden energy
injection in the lepton population, mimicking the effect of a shock wave or the
dissipation of magnetic energy. Equilibrium restoration occurs due to energy
exchange between the photons and leptons. While the initial and final
equilibrium spectra are thermal, the transitional photon spectra are
characterized by non-thermal features such as power-law tails, high energy
bumps, and multiple components. Such non-thermal features are observed at
infinity if the dissipation occurs at small to moderate optical depths, and the
spectrum is released before thermalization is complete. We model the synthetic
spectra with a Band function and show that the resulting spectral parameters
are similar to observations for a frequency range of 2-3 orders of magnitude
around the peak. In addition, our model predicts correlations between the
low-frequency photon index and the peak frequency as well as between the low-
and high-frequency indices. We explore baryon and pair dominated fireballs and
reach the conclusion that baryonic fireballs are a better model for explaining
the observed features of gamma-ray burst spectra.
