We propose a new mechanism for inflationary magnetogenesis in which the local U(1) symmetry is broken during inflation. Nevertheless it is shown that the U(1) symmetry is recovered on-shell. We find that it is free from both the strong coupling and back reaction problems, and can explain the origin of cosmic magnetic fields on intergalactic scales, whose existence has been strongly suggested by recent observations.