When the universe cools through a phase transition, the complex scalar field φ = |φ|e^{iθ} acquires a vacuum expectation value. Domains with different phase θ form independently; where the total phase winds by ±2π around a closed loop, a topological defect (cosmic string) is trapped. The winding number is a conserved integer charge.