X-ray sources at intermediate fluxes (a few x 10<sup>-14</sup> erg/cm<sup>2</sup>/s) with a sky density of ~ 100 deg<sup>2</sup> are responsible for a significant fraction of the cosmic X-ray background at various energies below 10 keV. The aim of this study is to provide an unbiased and quantitative description of the X-ray source population at these fluxes and in various X-ray energy bands. The XMM-Newton Medium sensitivity Survey (XMS) includes a total of 318 X-ray sources found among the serendipitous content of 25 XMM-Newton target fields. The XMS comprises four largely overlapping source samples selected at soft (0.5 - 2 keV), intermediate (0.5 - 4.5 keV), hard (2 - 10 keV) and ultra-hard (4.5 - 7.5 keV) bands, the first three of them being flux-limited. This study reports on the optical identification of the XMS samples, complete to 85 - 95%. At the flux levels sampled by the XMS, the authors find that the X-ray sky is largely dominated by Active Galactic Nuclei. The fraction of stars in soft X-ray selected samples is below 10%, and only a few per cent for hard X-ray selected samples. They find that the fraction of optically obscured objects in the AGN population stays constant at around 15-20% for soft and intermediate band selected X-ray sources, over 2 decades of flux. The fraction of obscured objects amongst the AGN population is larger (~ 35 - 45%) in the hard or ultra-hard selected samples, and constant across a similarly wide flux range. The distribution in X-ray-to-optical flux ratio is a strong function of the selection band, with a larger fraction of sources with high values in hard selected samples. Sources with X-ray-to-optical flux ratios in excess of 10 are dominated by obscured AGN, but with a significant contribution from unobscured AGN. This table was created by the HEASARC in March 2008 based on <a href="https://cdsarc.cds.unistra.fr/ftp/cats/J/A+A/476/1191">CDS catalog J/A+A/476/1191</a> files table2.dat and table5.dat. This is a service provided by NASA HEASARC .