  The aim of the present work is to perform a comprehensive analysis of the
interstellar chemistry of nitrogen, focussing on the gas-phase formation of the
smallest polyatomic species and in particular nitrogen hydrides. We present a
new chemical network in which the kinetic rates of critical reactions have been
updated based on recent experimental and theoretical studies, including nuclear
spin branching ratios. Our network thus treats the different spin symmetries of
the nitrogen hydrides self-consistently together with the ortho and para forms
of molecular hydrogen. This new network is used to model the time evolution of
the chemical abundances in dark cloud conditions. The steady-state results are
analysed, with special emphasis on the influence of the overall amounts of
carbon, oxygen, and sulphur. Our calculations are also compared with
Herschel/HIFI observations of NH, NH$_2$, and NH$_3$ detected towards the
external envelope of the protostar IRAS 16293-2422. The observed abundances and
abundance ratios are reproduced for a C/O gas-phase elemental abundance ratio
of $\sim0.8$, provided that the sulphur abundance is depleted by a factor
larger than 2. The ortho-to-para ratio of H$_2$ in these models is
$\sim10^{-3}$. Our models also provide predictions for the ortho-to-para ratios
of NH$_2$ and NH$_3$ of $\sim2.3$ and $\sim0.7$ respectively. We conclude that
the abundances of nitrogen hydrides in dark cloud conditions are consistent
with the gas-phase synthesis predicted with our new chemical network.
