  In this paper we combine archival and proprietary XMM-Newton observations
(about 5deg^2) that overlap with the Sloan Digital Sky Survey to explore the
nature of the moderate-z X-ray population. We focus on X-ray sources with
optically red colours (g-r>0.4), which we argue are important for understanding
the origin of the X-ray background. Firstly, these systems constitute a
significant fraction, about 2/3, of the z<1 X-ray population to the limit
f(2-8keV)~2e-14cgs. Secondly, their luminosity function under evolution of the
form ~(1+z)^3 suggests that they could be responsible for about 17 per cent of
the diffuse X-ray background to z=1. Thirdly, their stacked X-ray spectrum in
the range 1-8keV is consistent with a power-law distribution with Gamma~1.4
(without fitting intrinsic absorption), i.e. similar to the diffuse X-ray
background. We find that the optically red X-ray population comprises a mixed
bag of objects, both obscured (N_H>1e22 cm^{-2}) and unobscured (N_H<1e22
cm^{-2}), with a wide range of X-ray luminosities up L_X~1e44cgs. We argue that
dilution of the AGN light by the host galaxy may play a role in shaping the
continuum optical emission of this population. Finally, we explore a possible
association of these sources and the moderate-z red (J-Ks>2mag) AGNs identified
in the Two Micron All Sky Survey (2MASS). The median N_H of the red X-ray
sources studied here is ~1e21cm^{-2}, lower than that found for the 2MASS AGNs,
suggesting different populations.
