  A detailed analysis is presented of the diffractive deep-inelastic scattering
process $ep\to eXY$, where $Y$ is a proton or a low mass proton excitation
carrying a fraction $1 - \xpom > 0.95$ of the incident proton longitudinal
momentum and the squared four-momentum transfer at the proton vertex satisfies
$|t|<1 {\rm GeV^2}$. Using data taken by the H1 experiment, the cross section
is measured for photon virtualities in the range $3.5 \leq Q^2 \leq 1600 \rm
GeV^2$, triple differentially in $\xpom$, $Q^2$ and $\beta = x / \xpom$, where
$x$ is the Bjorken scaling variable. At low $\xpom$, the data are consistent
with a factorisable $\xpom$ dependence, which can be described by the exchange
of an effective pomeron trajectory with intercept $\alphapom(0)= 1.118 \pm
0.008 {\rm (exp.)} ^{+0.029}_{-0.010} {\rm (model)}$. Diffractive parton
distribution functions and their uncertainties are determined from a
next-to-leading order DGLAP QCD analysis of the $Q^2$ and $\beta$ dependences
of the cross section. The resulting gluon distribution carries an integrated
fraction of around 70% of the exchanged momentum in the $Q^2$ range studied.
Total and differential cross sections are also measured for the diffractive
charged current process $e^+ p \to \bar{\nu}_e XY$ and are found to be well
described by predictions based on the diffractive parton distributions. The
ratio of the diffractive to the inclusive neutral current $ep$ cross sections
is studied. Over most of the kinematic range, this ratio shows no significant
dependence on $Q^2$ at fixed $\xpom$ and $x$ or on $x$ at fixed $Q^2$ and
$\beta$.
