We generalise the positive solution of the Frobenius conjecture (by J. Thompson) and refinements thereof (by Higman, Kreknin, and Kostrikin). This allows us to also extend the positive solution of the restricted Burnside problem for prime exponents (by Kostrikin) and a generalisation of it (by E. Khukhro).We do this by studying the structure of groups that admit an automorphism with a prescribed polynomial identity. In fact, to each polynomial r(twe assign integer-valued invariants ι 1 and ι 2 , and we will prove that they satisfy the following property. Let G be a finite group with an automorphism α :By specialising r(t) to linear, cyclotomic or Anosov polynomials, we can also recover and extend a number of results in the literature. * MSC2010: 20D45 (automorphisms of groups), 20D15 (nilpotent groups), 17B70 (graded Lie algebras). † This work was supported by the Austrian Science Fund (FWF) grants: J − 3371 − N 25 ("Representations and gradings of solvable Lie algebras") and P 30842 − N 35 ("Infinitesimal Lie rings: gradings and obstructions").