AbstractIn 1978 Métivier showed that a linear differential operator P with analytic coefficients is elliptic if and only if the theorem of iterates holds for P with respect to any non-analytic Gevrey class. In this paper we extend this theorem to Denjoy–Carleman classes given by strongly non-quasianalytic weight sequences. The proof involves a new way to construct optimal functions in Denjoy–Carleman classes via Fourier integrals, which might be of independent interest. Moreover, we point out that the analogous statement for Braun–Meise–Taylor classes given by weight functions cannot hold. This signifies an important difference in the properties of Denjoy–Carleman classes and Braun–Meise–Taylor classes, respectively.