We study the consistency of orbifold field theories and clarify to what extent the condition of having an anomaly-free spectrum of zero modes is sufficient to guarantee it. Preservation of gauge invariance at the quantum level is possible, although at the price, in general, of introducing operators that break the 5D local parity. These operators are, however, perfectly consistent with the orbifold projection. We also clarify the relation between localized Fayet-Iliopoulos (FI) terms and anomalies. These terms can be consistently added, breaking neither local supersymmetry nor gauge symmetry. In the framework of supergravity the localized FI term arises as the boundary completion of a bulk interaction term: given the bulk Lagrangian the FI is fixed by gauge invariance.