We present an XMM observation of the radio jet and diffuse halo of the nearby radio galaxy NGC6251. The EPIC spectrum of the galaxys halo is best-fitted by a thermal model with temperature kT~1.6 keV and subsolar abundances. Interestingly, an additional hard X-ray component is required to fit the EPIC spectra of the halo above 3 keV, and is independently confirmed by an archival Chandra observation. However, its physical origin is not clear. Contribution from a population of undetected Low Mass X-ray Binaries seems unlikely. Instead, the hard X-ray component could be due to inverse Compton scattering of the CMB photons off relativistic electrons scattered throughout the halo of the galaxy, or non-thermal bremsstrahlung emission. The IC/CMB interpretation, together with limits on the diffuse radio emission, implies a very weak magnetic field, while a non-thermal bremsstrahlung origin implies the presence of a large number of very energetic electrons. We also detect X-ray emission from the outer (~3.5) jet, confirming previous ROSAT findings. Both the EPIC and ACIS spectra of the jet are best-fitted by a power law with photon index ~1.2. A thermal model is formally ruled out by the data. Assuming an origin of the X-rays from the jet via IC/CMB, as suggested by energetic arguments, and assuming equipartition implies a large Doppler factor (delta~10). Alternatively, weaker beaming is possible for magnetic fields several orders of magnitude lower than the equipartition field.