We consider the statistical mechanics of a class of models involving close-packed loops with fugacity n on three-dimensional lattices. The models exhibit phases of two types as a coupling constant is varied: in one, all loops are finite, and in the other, some loops are infinitely extended. We show that the loop models are discretisations of CP n−1 σ models. The finite and infinite loop phases represent, respectively, disordered and ordered phases of the σ model, and we discuss the relationship between loop properties and σ model correlators. On large scales, loops are Brownian in an ordered phase and have a non-trivial fractal dimension at a critical point. We simulate the models, finding continuous transitions between the two phases for n = 1, 2, 3 and first order transitions for n ≥ 4. We also give a renormalisation group treatment of the CP n−1 model that shows how a continuous transition can survive for values of n larger than (but close to) two, despite the presence of a cubic invariant in the Landau-Ginzburg description. The results we obtain are of broader relevance to a variety of problems, including SU (n) quantum magnets in (2+1) dimensions, Anderson localisation in symmetry class C, and the statistics of random curves in three dimensions.