We report the results of a multi-wavelength investigation of the O4 V star 9 Sgr (= HD 164794). Our data include observations in the X-ray domain with XMM-Newton, in the radio domain with the VLA as well as optical spectroscopy. 9 Sgr is one of a few presumably single OB stars that display non-thermal radio emission. This phenomenon is attributed to synchrotron emission by relativistic electrons accelerated in strong hydrodynamic shocks in the stellar wind. Given the enormous supply of photospheric UV photons in the wind of 9 Sgr, inverse Compton scattering by these relativistic electrons is a priori expected to generate a non-thermal power law tail in the X-ray spectrum. Our EPIC and RGS spectra of 9 Sgr reveal a more complex situation than expected from this simple theoretical picture. While the bulk of the thermal X-ray emission from 9 Sgr arises most probably in a plasma at temperature ~ 3 x 106 K distributed throughout the wind, the nature of the hard emission in the X-ray spectrum is less clear. Assuming a non-thermal origin, our best fitting model yields a photon index of >=2.9 for the power law component which would imply a low compression ratio of =2 x 107 K. Our VLA data indicate that the radio emission of 9 Sgr was clearly non-thermal at the time of the XMM-Newton observation. Again, we derive a low compression ratio (1.7) for the shocks that accelerate the electrons responsible for the synchrotron radio emission. Finally, our optical spectra reveal long-term radial velocity variations suggesting that 9 Sgr could be a long-period spectroscopic binary. Based on observations with XMM-Newton, an ESA Science Mission with instruments and contributions directly funded by ESA Member states and the USA (NASA). Also based on observations collected at the European Southern Observatory (La Silla, Chile) and with the Very Large Array. The VLA is a facility of the National Radio Astronomy Observatory which is operated by the Associated Universities Inc. under cooperative agreement with the National Science Foundation.