  (Abridged) We present a systematic fit of a model of resonant cyclotron
scattering (RCS) to the X-ray data of ten magnetars, including canonical and
transient anomalous X-ray pulsars (AXPs), and soft gamma repeaters (SGRs). In
this scenario, non-thermal magnetar spectra in the soft X-rays (i.e. below ~10
keV) result from resonant cyclotron scattering of the thermal surface emission
by hot magnetospheric plasma. We find that this model can successfully account
for the soft X-ray emission of magnetars, while using the same number of free
parameters than the commonly used empirical blackbody plus power-law model.
However, while the RCS model can alone reproduce the soft X-ray spectra of
AXPs, the much harder spectra of SGRs below ~10 keV, requires the addition of a
power-law component (the latter being the same component responsible for their
hard X-ray emission). Although this model in its present form does not explain
the hard X-ray emission of a few of these sources, we took this further
component into account in our modeling not to overlook their contribution in
the ~4-10 keV band. We find that the entire class of sources is characterized
by magnetospheric plasma with a density which, at resonant radius, is about 3
orders of magnitudes higher than n_{GJ}, the Goldreich-Julian electron density.
The inferred values of the intervening hydrogen column densities, are also in
better agreement with more recent estimates inferred from the fit of single
X-ray edges. For the entire sample of observations, we find indications for a
correlation between the scattering depth and the electron thermal velocity, and
the field strength. Moreover, in most transient anomalous X-ray pulsars the
outburst state is characterized by a relatively high surface temperature which
cools down during the decay.
