To investigate the role of habitat fragmentation, fragment age and local environment in shaping the genetics of plant populations, we examined the genetic structure of the self-compatible forest herb Geum urbanum using microsatellite markers. A historical land-use reconstruction assigned the studied populations to two age classes: populations in primary forest fragments, and populations in secondary fragments. Local environmental conditions were quantified on the basis of the herb-layer community composition. A stepwise general linear model revealed that levels of within-population genetic diversity were best explained by population size, landscape connectivity and the interaction between both. Connectivity was positively correlated with the genetic diversity of small populations, but did not significantly affect the diversity of large populations. Contrary to what we expected, secondary-forest populations showed lower divergence relative to populations located in primary patches. Small populations were genetically more diverged compared to large populations. Mantel tests showed no significant isolation by distance and no significant correlation between habitat similarity and genetic differentiation. We conclude that gene flow has probably prevented founder events from being reflected in the present genetic structure of G. urbanum. Gene flow towards low-connectivity populations, however, seemed to be insufficient to counteract the effects of drift in small populations.