The present invention relates to an ampholytic copolymer based on quaternized nitrogen-containing monomers which has a molar excess of cationogenic/cationic groups compared to anionogenic/anionic groups, to cosmetic or pharmaceutical compositions which comprise at least one such ampholytic copolymer, and to further uses of these copolymers.