Abstract:We present the results of a magnetic survey of a sample of eight betaCephei stars and 26 slowly pulsating B (SPBs) stars with the FOcal Reducer low dispersion Spectrograph at the Very Large Telescope. A weak mean longitudinal magnetic field of the order of a few hundred Gauss is detected in the betaCephei star xi1 CMa and in 13 SPB stars. The star xi1 CMa becomes the third magnetic star among the betaCephei stars. Before our study, the star zetaCas was the only known magnetic SPB star. All magnetic SPB stars for which we gathered several magnetic field measurements show a field that varies in time. We do not find a relation between the evolution of the magnetic field with stellar age in our small sample. Our observations imply that betaCephei and SPB stars can no longer be considered as classes of non-magnetic pulsators, but the effect of the fields on the oscillation properties remains to be studied.