_This is the author’s version of the work. It is posted here for personal use, not for redistribution. The definitive version was published in Nature on 04 January 2016, DOI:10.1038/nature16171_ Magnetic fields play a role in almost all stages of stellar evolution . Most low-mass stars, including the Sun, show surface fields that are generated by dynamo processes in their convective envelopes . Intermediate-mass stars do not have deep convective envelopes , although 10% exhibit strong surface fields that are presumed to be residuals from the stellar formation process . These stars do have convective cores that might produce internal magnetic fields , and these might even survive into later stages of stellar evolution, but information has been limited by our inability to measure the fields below the stellar surface . Here we use asteroseismology to study the occurrence of strong magnetic fields in the cores of low- and intermediate-mass stars. We have measured the strength of dipolar oscillation modes, which can be suppressed by a strong magnetic field in the core , in over 3,600 red giant stars observed by . About 20% of our sample show mode suppression but this fraction is a strong function of mass. Strong core fields only occur in red giants above 1.1 solar masses (1.1), and the occurrence rate is at least 60% for intermediate-mass stars (1.6–2.0), indicating that powerful dynamos were very common in the convective cores of these stars.