Background and aims In pristine ombrotrophic Sphagnum-dominated peatland ecosystems nitrogen (N) is often a limiting nutrient, which is replenished by biological N 2 fixation and atmospheric N deposition. It is, however, unclear which impact long-term N deposition has on microbial N 2 fixing activity and diazotrophic diversity, and whether phosphorus (P) modulates the response. Therefore, we studied the impact of increased N deposition and N depletion on microbial N 2 fixation and diazotrophic diversity associated with the peat moss Sphagnum magellanicum, and their interaction with P availability. Methods Nitrogenase activities of S. magellanicumassociated microorganisms were determined by acetylene reduction assays (ARA) and 15 N 2 tracer methods on mosses from two geographically distinct locations with different N deposition histories, high or low N deposition, and in samples depleted in N (grown 3 years in the greenhouse) versus recent field samples. The short-term response to increased N deposition was tested for mosses differing in N and P fertilization histories. In addition, diversity of diazotrophic microorganisms was assessed by nifH gene amplicon sequencing of N-depleted mosses. Results We showed distinct and persistent differences in diazotrophic communities and their activities associated with S. magellanicum from sites with high versus low N deposition. Initially, diazotrophic activity was six times higher for the low N site. During incubation and repeated ARA, however, this activity strongly decreased, while it remained stable for the high N site. Activity for the high N site could not be increased by long-term experimental N deprivation. Short-term, experimental N application had an inhibitory effect on N 2 fixation for both sites, which was not observed in mosses with high indirect P availability. Conclusions We conclude that although N deposition negatively affects N 2 fixation as also shown in previous studies, long-term effects of N deprivation on the diazotrophic activity and community are more complex. Furthermore, our results indicated that P availability might be an important factor in modulating the response of Sphagnum-associated diazotrophs to N deposition.