  Cosmic objects with magnetic fields (quasars, radiogalaxies) are observed at
redshifts $z\geq 7$ (Wang et al., 2021, Fan et al., 2023, Yang et al., 2024)
and more (for instance, for $z = 10.073\pm 0.002$, Goulding et al., 2023)
indicates the early creation of magnetic fields. The observations of the cosmic
telescope JWST show that the first galaxies were formed at redshifts $z\simeq$
15 -- 20. We link the transformation of the low mass dark matter halos into
galaxies with the creation of the first stars owing to the radiative cooling of
partly ionized hydrogen at $z\geq 10$. The early formation of galaxies creates
favourable conditions for high impact of the Compton scattering of the relic
radiation photons and electrons on the electron temperature and leads to the
partial separation of electrons and protons. Together with turbulent motions
such separation stimulates creation of magnetic fields on a galactic scale. The
same processes distort the primordial perturbations of the relic radiation what
can be observed and confirmed in special simulations.
