Recent studies in salt marshes have demonstrated the role of plant roots in sediment stabilisation, and hence the importance of marshes in providing coastal protection. However, the relative role of root traits and environmental factors in controlling sediment stability, and how intraspecific variability of root traits vary within and among marshes, remain poorly understood. In this study, we investigated which root trait(s) drive sediment stability (resistance to lateral erosion) in two marsh species with an important role in coastal protection (Spartina anglica and Atriplex portulacoides) and how the environment affects the expression of these traits. We sampled three marshes along salinity gradients in each of two estuaries in Wales (UK), establishing replicate plots in the respective dominant zones of each species. In all plots we sampled abiotic variables (sand, redox potential, pH, salinity) and root traits (root density, specific root density, root volume, root length density); in a subset of these plots (three per species in each marsh) we extracted soil-plant cores and assessed their erosion resistance in a flume. Sediment stability was enhanced by increases in root density and reductions in sand content. Abiotic variables affected root density in different ways depending on species: in S. anglica, redox was the only significant factor, with a positive, linear effect on root density; in A. portulacoides, redox had a non-linear (U-shaped) effect on root density, while sand had a negative effect. Collectively, these results show that (i) intraspecific variability in root density can influence sediment stability in salt marshes, and (ii) sediment properties not only influence sediment stability directly, but also indirectly via root density. These results shed light on spatial variability in the stability of salt marshes to lateral erosion and suggest that root density should be incorporated into coastal vegetation monitoring programs as an easy-to-measure root trait that links the environment to sediment stability and hence to the function and services provided by marshes.