Over the past 25 years, hundreds of empirical studies established that there is generally a positive relationship between the functioning of an ecosystem and the number of species it contains. Ongoing global biodiversity loss by anthropogenic activities therefore poses a major threat to future ecosystem function provisioning. However, recent studies showed that environmental stress, including exposure to chemicals, can alter the biodiversity-ecosystem functioning (BEF) relationship, and hence the consequences of biodiversity loss. In this paper Baert et al. reveal for the first time the mechanisms underlying changes in BEF relationships by environmental stress. By using a simple community model, Baert et al. demonstrate that changes in the BEF relationship in a marine microalgal microcosm experiment could be explained from species stress tolerances and the strength of per-capita species interactions.