In fusion devices, the geometry of the confining magnetic field has a significant impact on the instabilities that drive turbulent heat loss. This is especially true of stellarators, where the density-gradient-driven branch of the ‘trapped electron mode’ (TEM) is predicted to be linearly stable if the magnetic field has the maximum-J property, as is very approximately the case in certain magnetic configurations of the Wendelstein 7-X experiment (W7-X). Here we show, using both analytical theory and simulations, that the benefits of the optimisation of W7-X also serve to mitigate ion-temperature-gradient (ITG) modes as long as an electron density gradient is present. We find that the effect indeed carries over to nonlinear numerical simulations, where W7-X has low TEM-driven transport, and reduced ITG turbulence in the presence of a density gradient, giving theoretical support for the existence of enhanced confinement regimes, in the presence of strong density gradients (e.g. hydrogen pellet or neutral beam injection).