Throughout the world, the highly selfing annual common groundsel, Senecio vulgaris (Asteraceae) is a common weed. Recently, it has also colonized ecological compensation areas in agro-ecosystems. We investigated the genetic structure of S. vulgaris using random amplified polymorphic DNA (RAPD) profiles of 80 plants from nine populations representing three habitat types in two regions in Switzerland. RAPD variation among regions (19.8%), among populations within regions (19.2%) and within populations (61.1%) was highly significant (amova; P < 0.001). Gene flow estimated from the observed differentiation among populations (ΦST = 0.382) was low (assuming Wright’s island model, Nem = 0.404). Genetic distances between pairs of populations were significantly correlated with geographical distances (Mantel test; r = 0.37, P < 0.03). Molecular variance obtained with amova was lowest in the small populations in compensation areas (1.13), intermediate in vineyard populations (2.49), all located in northern Switzerland and highest in the larger vegetable field populations from western Switzerland (3.41; P < 0.05). Overall, there was a positive correlation of molecular variance and population size (P < 0.05), as expected under genetic drift. However, molecular variance was negatively correlated with population size among populations in ecological compensation areas, suggesting that selection was also important. We also applied triazine herbicide to leaves of three offspring of each of the 80 plants. Plants from populations of compensation areas showed higher mean levels and reduced variation in the resistance to triazine herbicide than plants from vineyards and vegetable fields. This suggests that compensation areas were colonized from adjacent corn fields, in which there has been selection for herbicide resistance. We discuss the implications of our results for the biological control of S. vulgaris.