Fine-scale genetic structure of plant populations depends on several ecological processes. In this study, we analyzed the impact of hydrological heterogeneity on the spatial genetic structure of the wind-pollinated black sedge Carex nigra in an alpine fen. We performed amplified fragment length polymorphisms (AFLPs) with 111 samples collected along a grid covering the whole area of the fen and studied fine-scale genetic structure using spatial autocorrelation and Bayesian cluster analyses. We observed a significant spatial genetic structure indicating isolation-by-distance, which can be ascribed to restricted seed dispersal. Bayesian cluster analysis revealed four groups of genetically related and patchy distributed samples within the fen. Two of these groups were distributed in the deeper and moister regions of the fen, while the two other groups were spatially restricted to the higher and drier regions of the fen. We think that the observed pattern of spatial genetic variation reflects hydrological heterogeneity within the fen and conclude that the four groups represent cohorts of individuals originating from different recruitment events in different parts of the fen. Genetic variation was much lower in the groups from the drier regions of the fen. Since Carex species require moist conditions for germination and establishment, the low level of genetic variation can most likely be ascribed to restricted seedling recruitment in the drier regions of the fen. Habitat heterogeneity affects, therefore, both spatial genetic structure and levels of genetic variation. This study clearly demonstrates that integrating fine-scale genetic analyses with complementary biological data can markedly improve the identification of processes that shape fine-scale genetic structure within plant populations.