We propose a new mechanism for formation of topological defects in a U(1) model with a local gauge symmetry. This mechanism leads to definite predictions, which are qualitatively different from those of the Kibble-Zurek mechanism of global theories. We confirm these predictions in numerical simulations, and they can also be tested in superconductor experiments. We believe that the mechanism generalizes to more complicated theories.