We present the analysis of an XMM-Newton observation of the M17 nebula. The X-ray point source population consists of massive O-type stars and a population of probable low-mass pre-main sequence stars. CEN1a,b and OI352, the X-ray brightest O-type stars in M17, display hard spectra (kT of 3.8 and 2.6 keV) consistent with a colliding wind origin in binary/multiple systems. We show that the strong interstellar reddening towards the O-type stars of M17 yields huge uncertainties on their Lx/Lbol values. The low-mass pre-main sequence stars exhibit hard spectra resulting from a combination of high plasma temperatures and very large interstellar absorption. We find evidence for considerable long term (months to years) variability of these sources. M17 is one of the few star formation complexes in our Galaxy producing diffuse X-ray emission. We analyze the spectrum of this emission and compare it with previous studies. Finally, we discuss the Optical Monitor UV data obtained simultaneously with the X-ray images. We find very little correspondence between the UV and X-ray sources, indicating that the majority of the UV sources are foreground stars, whilst the bulk of the X-ray sources are deeply embedded in the M17 complex.