@David Drayer the Earth's magnetic field doesn't deflect much in the way of electromagnetic radiation, which is light. The atmosphere is what protects us from that. Our magnetic field deflects the solar wind, which is composed of electrically charged particles emanating from the Sun. If those particles were allowed to collide with our atmosphere, they would strip away that protective barrier, and yes, we would be exposed to dangerous EM radiation, but the magnetic field does not block it directly.
How was the earth magnetic field created? Why is it so important?