Anomalies in nonlinear sigma models can sometimes be cancelled by local counterterms. We show that these counterterms have a simple topological interpretation, and that the requirements for anomaly cancellation can be easily understood in terms of 't Hooft's anomaly matching conditions. We exhibit the anomaly cancellation on homogeneous spaces G H and on general riemannian manifolds M . We include external gauge fields on the manifolds and derive the generalized anomaly-cancellation conditions. Finally, we discuss the implications of this work for superstring theories.