Deep--inelastic scattering events with a leading baryon have been detected by the H1 experiment at HERA using a forward proton spectrometer and a forward neutron calorimeter. Semi--inclusive cross sections have been measured in the kinematic region 2 <= Q^2 <= 50 GeV^2, 6.10^-5 <= x <= 6.10^-3 and baryon p_T <= MeV, for events with a final state proton with energy 580 <= E' <= 740 GeV, or a neutron with energy E' >= 160 GeV. The measurements are used to test production models and factorization hypotheses. A Regge model of leading baryon production which consists of pion, pomeron and secondary reggeon exchanges gives an acceptable description of both semi-inclusive cross sections in the region 0.7 <= E'/E_p <= 0.9, where E_p is the proton beam energy. The leading neutron data are used to estimate for the first time the structure function of the pion at small Bjorken--x.