  The Gerasimov-Drell-Hearn (GDH) sum rule connects the anomalous contribution
to the magnetic moment of the target nucleus with an energy-weighted integral
of the difference of the helicity-dependent photoabsorption cross sections. The
data collected by HERMES with a deuterium target are presented together with a
re-analysis of previous measurements on the proton. This provides a measurement
of the generalised GDH integral covering simultaneously the nucleon-resonance
and the deep inelastic scattering regions. The contribution of the
nucleon-resonance region is seen to decrease rapidly with increasing $Q^2$. The
DIS contribution is sizeable over the full measured range, even down to the
lowest measured $Q^2$. As expected, at higher $Q^2$ the data are found to be in
agreement with previous measurements of the first moment of $g_1$. From data on
the deuteron and proton, the GDH integral for the neutron has been derived and
the proton--neutron difference evaluated. This difference is found to satisfy
the fundamental Bjorken sum rule at $Q^2 = 5$ GeV$^2$.
