We present an XMM-Newton observation of the radio jet and diffuse halo of the nearby radio galaxy NGC 6251. The EPIC spectrum of the galaxy's halo is best-fitted by a thermal model with temperature kT ∼ 1.6 keV and sub-solar 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 (IC/CMB) 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, B ≪ 1 μGauss, 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, fixed Galactic column density, and 1 keV flux F1 keV=2.1 nJy. 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 (δ ∼ 10). Alternatively, weaker beaming is possible for magnetic fields several orders of magnitude lower than the equipartition field.