Context : Aims : Our goal is to probe the populations of obscured and unobscured AGN investigating their optical-IR and X-ray properties as a function of X-ray flux , luminosity and redshift within a hard X-ray selected sample with wide multiwavelength coverage . Methods : We selected a sample of 136 X-ray sources detected at a significance of \geq 3 \sigma in the 2 - 10 keV band ( F _ { 2 - 10 } \ga 10 ^ { -14 } erg cm ^ { -2 } s ^ { -1 } ) in a \sim 1 deg ^ { 2 } area in the XMM Medium Deep Survey ( XMDS ) . The XMDS area is covered with optical photometry from the VVDS and CFHTLS surveys and infrared Spitzer data from the SWIRE survey . Based on the X-ray luminosity and X-ray to optical ratio , 132 sources are likely AGN , of which 122 have unambiguous optical - IR identification . The observed optical and IR spectral energy distributions of all identified sources are fitted with AGN/galaxy templates in order to classify them and compute photometric redshifts . X-ray spectral analysis is performed individually for sources with a sufficient number of counts and using a stacking technique for subsamples of sources at different flux levels . Hardness ratios are used to estimate X-ray absorption in individual weak sources . Results:70 % of the AGN are fitted by a type 2 AGN or a star forming galaxy template . We group them together in a single class of “ optically obscured ” AGN . These have “ red ” optical colors and in about 60 % of cases show significant X-ray absorption ( N _ { H } > 10 ^ { 22 } cm ^ { -2 } ) . Sources with SEDs typical of type 1 AGN have “ blue ” optical colors and exhibit X-ray absorption in about 30 % of cases . The stacked X-ray spectrum of obscured AGN is flatter than that of type 1 AGN and has an average spectral slope of \Gamma = 1.6 . The subsample of objects fitted by a star forming galaxy template has an even harder stacked spectrum , with \Gamma \sim 1.2 - 1.3 . The obscured fraction is larger at lower fluxes , lower redshifts and lower luminosities . X-ray absorption is less common than “ optical ” obscuration and its incidence is nearly constant with redshift and luminosity . This implies that at high luminosities X-ray absorption is not necessarily related to optical obscuration . The estimated surface densities of obscured , unobscured AGN and type 2 QSOs are respectively 138 , 59 and 35 deg ^ { -2 } at F > 10 ^ { -14 } erg cm ^ { -2 } s ^ { -1 } . Conclusions :