  We extend the classical regularity theorem of elliptic operators to maximally
hypoelliptic differential operators. More precisely, given vector fields
$X_1,\ldots,X_m$ on a smooth manifold which satisfy H\"ormander's bracket
generating condition, we define a principal symbol for \textit{any} linear
differential operator. Our symbol takes into account the vector fields $X_i$
and their commutators. We show that for an arbitrary differential operator, its
principal symbol is invertible if and only if the operator is maximally
hypoelliptic. This answers affirmatively a conjecture due to Helffer and
Nourrigat. Our result is proven in a more general setting, where we allow each
one of the vector fields $X_1,\ldots,X_m$ to have an arbitrary weight. In
particular, our theorem generalizes H\"ormander's sum of squares theorem to
higher order polynomials.
