An agent for treating keratin-containing fibers, in particular human hair, containing in a cosmetically acceptable carrier: (a) at least one amphiphilic, cationic polymer comprising at least one structural unit of formula, at least one structural unit of formula, at least one structural unit of formula, and at least one structural unit of formula, where R 1 and R 4 represent, independently of one another, a hydrogen atom or a methyl group, X 1 and X 2 represent, independently of one another, an oxygen atom or a NH group, A 1 and A 2 represent, independently of one another, an ethane-1,2-diyl, propane-1,3-diyl or butane-1,4-diyl group, R 2, R 3, R 5 and R 6 represent, independently of one another, a (C 1 to C 4) alkyl group, and R 7 represents a (C 8 to C 30) alkyl group, and (b) at least one film-forming anionic and/or stabilizing anionic polymer comprising at least one structural unit of formula and at least one structural unit of formula, where R 8 and R 9 represent, independently of one another, a hydrogen atom or a methyl group, with the proviso that R 8 and R 9 do not simultaneously represent a methyl group, R 10 represents a hydrogen atom or a methyl group, R 11 represents a carbamoyl group, a linear or branched (C 4 to C 12) alkylaminocarbonyl group, a linear or branched (C 4 to C 12) alkylaminoethyl-aminocarbonyl group, a linear or branched (C 4 to C 12) alkylaminopropyl-aminocarbonyl group, a linear or branched (C 4 to C 12) alkyloxycarbonyl group, a linear or branched (C 4 to C 12) alkylaminoethyloxycarbonyl group, a linear or branched (C 4 to C 12) alkylaminopropyloxycarbonyl group, a linear or branched (C 2 to C 12) acyloxy group, A 3 represents a hydroxyl group or an organic functional group comprising at least one sulfonic acid group that bonds to the structural fragment through an oxygen atom or an NH group. (a) at least one amphiphilic, cationic polymer comprising at least one structural unit of formula, at least one structural unit of formula, at least one structural unit of formula, and at least one structural unit of formula, where R 1 and R 4 represent, independently of one another, a hydrogen atom or a methyl group, X 1 and X 2 represent, independently of one another, an oxygen atom or a NH group, A 1 and A 2 represent, independently of one another, an ethane-1,2-diyl, propane-1,3-diyl or butane-1,4-diyl group, R 2, R 3, R 5 and R 6 represent, independently of one another, a (C 1 to C 4) alkyl group, and R 7 represents a (C 8 to C 30) alkyl group, R 1 and R 4 represent, independently of one another, a hydrogen atom or a methyl group, X 1 and X 2 represent, independently of one another, an oxygen atom or a NH group, A 1 and A 2 represent, independently of one another, an ethane-1,2-diyl, propane-1,3-diyl or butane-1,4-diyl group, R 2, R 3, R 5 and R 6 represent, independently of one another, a (C 1 to C 4) alkyl group, and R 7 represents a (C 8 to C 30) alkyl group, (b) at least one film-forming anionic and/or stabilizing anionic polymer comprising at least one structural unit of formula and at least one structural unit of formula, where R 8 and R 9 represent, independently of one another, a hydrogen atom or a methyl group, with the proviso that R 8 and R 9 do not simultaneously represent a methyl group, R 10 represents a hydrogen atom or a methyl group, R 11 represents a carbamoyl group, a linear or branched (C 4 to C 12) alkylaminocarbonyl group, a linear or branched (C 4 to C 12) alkylaminoethyl-aminocarbonyl group, a linear or branched (C 4 to C 12) alkylaminopropyl-aminocarbonyl group, a linear or branched (C 4 to C 12) alkyloxycarbonyl group, a linear or branched (C 4 to C 12) alkylaminoethyloxycarbonyl group, a linear or branched (C 4 to C 12) alkylaminopropyloxycarbonyl group, a linear or branched (C 2 to C 12) acyloxy group, A 3 represents a hydroxyl group or an organic functional group comprising at least one sulfonic acid group that bonds to the structural fragment through an oxygen atom or an NH group. R 8 and R 9 represent, independently of one another, a hydrogen atom or a methyl group, with the proviso that R 8 and R 9 do not simultaneously represent a methyl group, R 10 represents a hydrogen atom or a methyl group, R 11 represents a carbamoyl group, a linear or branched (C 4 to C 12) alkylaminocarbonyl group, a linear or branched (C 4 to C 12) alkylaminoethyl-aminocarbonyl group, a linear or branched (C 4 to C 12) alkylaminopropyl-aminocarbonyl group, a linear or branched (C 4 to C 12) alkyloxycarbonyl group, a linear or branched (C 4 to C 12) alkylaminoethyloxycarbonyl group, a linear or branched (C 4 to C 12) alkylaminopropyloxycarbonyl group, a linear or branched (C 2 to C 12) acyloxy group, A 3 represents a hydroxyl group or an organic functional group comprising at least one sulfonic acid group that bonds to the structural fragment through an oxygen atom or an NH group.