The detection of delayed emission at X-ray optical and radio wavelengt
hs (''afterglow'') following gamma-ray bursts (GRBs) suggests that the
relativistic shell that emitted the initial GRB as the result of inte
rnal shocks decelerates on encountering an external medium, giving ris
e to the afterglow. We explore the interaction of a relativistic shell
with a uniform interstellar medium (ISM) up to the nonrelativistic st
age. We demonstrate the importance of several effects that were previo
usly ignored and must be included in a detailed radiation analysis. At
a very early stage (few seconds), the observed bolometric luminosity
increases as t(2). On longer timescales (more than similar to 10 s), t
he luminosity drops as t(-1). If the main burst is long enough, an int
ermediate stage of constant luminosity will form. In this case, the af
terglow overlaps the main burst; otherwise there is a time separation
between the two. On the long timescale, the flow decelerates in a self
-similar way, reaching nonrelativistic velocities after similar to 30
days. Explicit expressions for the radial profiles of this self-simila
r deceleration are given. As a result of the deceleration and the accu
mulation of ISM material, the relation between the observed time, the
shock radius, and its Lorentz factor is given by t = R/16 gamma(2)c, w
hich is a factor of 8 different from the usual expression. We show tha
t even though only a small fraction of the internal energy is given to
the electrons, most of the energy can be radiated over time. If the f
raction of energy in electrons is greater than similar to 10%, radiati
on losses will significantly influence the hydrodynamical evolution at
early times (less than similar to 1 day).