On the origin of galactic magnetic fields