A systematic study of the impact of impurities on the turbulent heat fluxes is presented for the stellarator Wendelstein 7-X (W7-X) and, for comparison, the Large Helical Device and ITER. By means of nonlinear multispecies gyrokinetic simulations, it is shown that impurities, depending on the sign of their density gradient, can significantly enhance or reduce turbulent ion heat losses. For the relevant scenario of turbulence reduction, an optimal impurity concentration that minimizes the ion heat diffusivity emerges as a universal feature. This result demonstrates the potential of impurities for controlling turbulence and accessing enhanced confinement regimes in fusion plasmas and, in particular, in W7-X.