A process for the preparation of an aqueous polymer dispersion by aqueous emulsion polymerization initiated by free radicals, wherein in an aqueous polymerization medium a) in a first polymerization stage ≥ 0.1 and ≤ 15 wt. % of at least one α,β-monoethylenically unsaturated compound having at least one acid group (monomers A1), > 0 and ≤ 10 wt.% of at least one monoethylenically unsaturated compound having at least one carboxylic acid amide group (monomers A2), ≥ 75 and ≤ 99.9 wt.% of at least one ethylenically unsaturated compound which differs from monomers A1, A2 and B1 (monomers A3), wherein the amounts of monomers A1 to A3 total 100 wt.%, are subjected to free radical polymerization to give a polymer A, thereafter in the presence of polymer A b) in a second polymerization stage ≥ 0.1 and ≤ 20 wt.% of at least one monoethylenically unsaturated compound having at least one oxazoline group (monomers B1), > 0 and ≤ 10 wt.% of at least one monoethylenically unsaturated compound having at least one carboxylic acid amide group (monomers B2), ≥ 70 and ≤ 99.9 wt.% of at least one ethylenically unsaturated compound which differs from monomers A1, B1 and B2 (monomers B3), wherein the amounts of monomers B1 to B3 total 100 wt.%, are subjected to free radical polymerization, with the proviso that • the weight ratio of the sum of the total amounts of monomers A1 to A3 (total monomer amount A) to the sum of the total amounts of monomers B1 to B3 (total monomer amount B) is in the range of 1:9 to 9:1, • the pH of the aqueous polymerization mixture during the first polymerization stage is < 5 and thereafter • before the start of the second polymerization stage the pH of the aqueous polymerization mixture is increased to > 6 by addition of a base, wherein the sum of the total amounts of monomers A2 and monomers B2 is ≥ 0.1 and ≤ 10 wt.%, based on the sum of total monomer amount A and total monomer amount B (total monomer amount). a) in a first polymerization stage ≥ 0.1 and ≤ 15 wt. % of at least one α,β-monoethylenically unsaturated compound having at least one acid group (monomers A1), > 0 and ≤ 10 wt.% of at least one monoethylenically unsaturated compound having at least one carboxylic acid amide group (monomers A2), ≥ 75 and ≤ 99.9 wt.% of at least one ethylenically unsaturated compound which differs from monomers A1, A2 and B1 (monomers A3), wherein the amounts of monomers A1 to A3 total 100 wt.%, are subjected to free radical polymerization to give a polymer A, thereafter in the presence of polymer A ≥ 0.1 and ≤ 15 wt. % of at least one α,β-monoethylenically unsaturated compound having at least one acid group (monomers A1), > 0 and ≤ 10 wt.% of at least one monoethylenically unsaturated compound having at least one carboxylic acid amide group (monomers A2), ≥ 75 and ≤ 99.9 wt.% of at least one ethylenically unsaturated compound which differs from monomers A1, A2 and B1 (monomers A3), b) in a second polymerization stage ≥ 0.1 and ≤ 20 wt.% of at least one monoethylenically unsaturated compound having at least one oxazoline group (monomers B1), > 0 and ≤ 10 wt.% of at least one monoethylenically unsaturated compound having at least one carboxylic acid amide group (monomers B2), ≥ 70 and ≤ 99.9 wt.% of at least one ethylenically unsaturated compound which differs from monomers A1, B1 and B2 (monomers B3), wherein the amounts of monomers B1 to B3 total 100 wt.%, are subjected to free radical polymerization, with the proviso that • the weight ratio of the sum of the total amounts of monomers A1 to A3 (total monomer amount A) to the sum of the total amounts of monomers B1 to B3 (total monomer amount B) is in the range of 1:9 to 9:1, • the pH of the aqueous polymerization mixture during the first polymerization stage is < 5 and thereafter • before the start of the second polymerization stage the pH of the aqueous polymerization mixture is increased to > 6 by addition of a base, wherein the sum of the total amounts of monomers A2 and monomers B2 is ≥ 0.1 and ≤ 10 wt.%, based on the sum of total monomer amount A and total monomer amount B (total monomer amount). ≥ 0.1 and ≤ 20 wt.% of at least one monoethylenically unsaturated compound having at least one oxazoline group (monomers B1), > 0 and ≤ 10 wt.% of at least one monoethylenically unsaturated compound having at least one carboxylic acid amide group (monomers B2), ≥ 70 and ≤ 99.9 wt.% of at least one ethylenically unsaturated compound which differs from monomers A1, B1 and B2 (monomers B3), • the weight ratio of the sum of the total amounts of monomers A1 to A3 (total monomer amount A) to the sum of the total amounts of monomers B1 to B3 (total monomer amount B) is in the range of 1:9 to 9:1, • the pH of the aqueous polymerization mixture during the first polymerization stage is < 5 and thereafter • before the start of the second polymerization stage the pH of the aqueous polymerization mixture is increased to > 6 by addition of a base,