Summary: Loss of microbial diversity is considered a major threat because of its importance for ecosystem functions, but there is a lack of conclusive evidence that diversity itself is reduced under anthropogenic stress, and about the consequences of diversity loss. Heavy metals are one of the largest, widespread pollutant types globally, and these represent a significant environmental stressor for terrestrial microbial communities. Using combined metagenomics and functional assays, we show that the compositional and functional response of microbial communities to long-term heavy metal stress results in a significant loss of diversity. Our results indicate that even at a moderate loss of diversity, some key specialized functions (carried out by specific groups) may be compromised. Together with previous work, our data suggest disproportionate impact of contamination on microbes that carry out specialized, but essential, ecosystem functions. Based on these findings, we propose a conceptual framework to explicitly consider diversity of functions and microbial functional groups to test the relationship between biodiversity and soil functions.