Grassland biodiversity is vulnerable to land use change. How to best manage semi-natural grasslands for maintaining biodiversity is still unclear in many cases because land-use processes may depend on environmental conditions and the indirect effects of land-use on biodiversity mediated by altered abiotic and biotic factors are rarely considered. Here we evaluate the relative importance of the direct and indirect effects of grazing intensity on plant communities along an elevational gradient on a large topographic scale in the Eastern Carpathians in Ukraine. We sampled for two years 31 semi-natural grasslands exposed to cattle grazing. Within each grassland site we measured plant community properties such as the number of species, functional groups, and the proportion of species undesirable for grazing. In addition, we recorded cattle density (as a proxy for grazing intensity), soil properties (bare soil exposure, soil organic carbon, and soil pH) and densities of soil decomposers (earthworms and soil microorganisms). We used structural equation modelling to explore the direct and indirect effects of grazing intensity on plant communities along the elevation gradient. We found that cattle density decreased plant species and functional diversity but increased the proportion of undesirable species. Some of these effects were directly linked to grazing intensity (i.e., species richness), while others (i.e., functional diversity and proportion of undesirable species) were mediated via bare soil exposure. Although grazing intensity decreased with elevation, the effects of grazing on the plant community did not change along the elevation gradient. Generally, elevation had a strong positive direct effect on plant species richness as well as a negative indirect effect, mediated via altered soil acidity and decreased decomposer density. Our results indicate that plant diversity and composition are controlled by the complex interplay among grazing intensity and changing environmental conditions along an elevation gradient. Furthermore, we found lower soil pH, organic carbon and decomposer density with elevation, indicating that the effects of grazing on soil and related ecosystem functions and services in semi-natural grasslands may be more pronounced with elevation. This demonstrates that we need to account for environmental gradients when attempting to generalize effects of land-use intensity on biodiversity.