The number of magnetic stars detected among massive stars is small ; nevertheless , the role played by the magnetic field in stellar evolution can not be disregarded . Links between line profile variability , enhancements/depletions of surface chemical abundances , and magnetic fields have been identified for low-mass B-stars , but for the O-type domain this is almost unexplored . Based on FORS 2 and HARPS spectropolarimetric data , we present the first detection of a magnetic field in HD 54879 , a single slowly rotating O9.7 V star . Using two independent and different techniques we obtained the firm detection of a surface average longitudinal magnetic field with a maximum amplitude of about 600 G , in modulus . A quantitative spectroscopic analysis of the star with the stellar atmosphere code fastwind results in an effective temperature and a surface gravity of 33000 \pm 1000 K and 4.0 \pm 0.1 dex . The abundances of carbon , nitrogen , oxygen , silicon , and magnesium are found to be slightly lower than solar , but compatible within the errors . We investigate line-profile variability in HD 54879 by complementing our spectra with spectroscopic data from other recent OB-star surveys . The photospheric lines remain constant in shape between 2009 and 2014 , although H \alpha shows a variable emission . The H \alpha emission is too strong for a standard O9.7 V and is probably linked to the magnetic field and the presence of circumstellar material . Its normal chemical composition and the absence of photospheric line profile variations make HD 54879 the most strongly magnetic , non-variable single O-star detected to date .