The occurrence of non-abelian anomalies in gauge theories and gravitation, first discovered via perturbative techniques, is now completely explained from the mathematical point of view by means of the family index theorem of Atiyah and Singer. Here we make contact between this approach and BRS cohomology, by showing that they yield the same non-abelian anomalies, provided a certain restriction to "local" functionals is not introduced from the very beginning. In particular, this solves the "unicity" problem for this kind of anomalies. Local BRS cohomology is still relevant for the abelian case.