  Some stellarators tend to benefit from favourable average magnetic curvature
for trapped particles when the plasma pressure is sufficiently high. This
so-called maximum-$J$-property has several positive implications such as good
fast-particle confinement, magnetohydrodynamic stability, and suppression of
certain trapped-particle instabilities. This property cannot be attained in
quasisymmetric stellarators, in which deeply trapped particles experience
average bad curvature and therefore precess in the diamagnetic direction close
to the magnetic axis. However, quasi-isodynamic stellarators offer greater
flexibility and allow the average curvature to be favourable and the precession
to be reversed. We find that it is possible to design such stellarators so that
the maximum-$J$ condition is satisfied for the great majority of all particles,
even when the plasma pressure vanishes. The qualitative properties of such a
stellarator field can be derived analytically by examining the most deeply and
the most shallowly trapped particles, although some small fraction of the
latter will inevitably not behave as desired. However, through numerical
optimisation, we construct a vacuum field in which 99.6% of all trapped
particles satisfy the maximum-$J$ condition.
