What is the main function of the magnetic field generated by the Earth's core layers?

Answer

Deflecting harmful solar radiation and cosmic rays

The magnetic field, generated by the structure of the inner core, outer core, mantle, and crust, acts as a shield against dangerous incoming radiation that would otherwise sterilize the surface.

What is the main function of the magnetic field generated by the Earth's core layers?
Earthenvironmentimportanceplanet