  Context. Magnetic fields are key to understand galaxy evolution, regulating
stellar feedback and star formation in galaxies. Aims. We probe the origin of
magnetic fields in late-type galaxies, measuring magnetic field strengths,
exploring whether magnetic fields are only passive constituents of the
interstellar medium, or whether they are active constituents being part of the
local energy equilibrium. Methods. We measure equipartition magnetic field
strengths in 39 galaxies from LoTSS-DR2 using LOFAR observations at 144 MHz
with 6 arcsec angular resolution which (0.1-0.7 kpc). For a subset of 9
galaxies, we obtain atomic and molecular mass surface densities using HI and
CO(2-1) data, from the THINGS and HERACLES surveys, respectively. These data
are at 13 arcsec angular resolution, which corresponds to 0.3-1.2 kpc at the
distances of our galaxies. We measure kinetic energy densities using HI and CO
velocity dispersions. Results. We found a mean magnetic field strength of
3.6-12.5 $\mu$G with a mean of $7.9 \pm 2.0$ $\mu$G across the full sample. The
magnetic field strength has the tightest and steepest relation with the total
gas surface density with $B\propto \Sigma_{\rm HI+H2}^{0.309\pm0.006}$. The
relation with the star-formation rate surface density and molecular gas surface
density has significantly flatter slopes. After accounting for the influence of
cosmic-ray transport, we found an even steeper relation of $B\propto
\Sigma_{\rm HI+H2}^{0.393\pm0.009}$. Conclusions. These results suggest that
the magnetic field is regulated by a $B$-$\rho$ relation, which has its origin
in the saturation of the small-scale dynamo. This is borne out by an agreement
of kinetic and magnetic energy densities although local deviations do exist in
particular in areas of high kinetic energy densities where the magnetic field
is sub-dominant.
