Fragmentation represents a serious threat to biodiversity worldwide, however its effects on epiphytic organisms is still poorly understood. We study the effect of habitat fragmentation on the genetic population structure and diversity of the red-listed epiphytic lichen, Lobaria pulmonaria, in a Mediterranean forest landscape. We tested the relative importance of forest patch quality, matrix surrounding fragments and connectivity on the genetic variation within populations and the differentiation among them. A total of 855 thalli were sampled in 44 plots (400m2) of 31 suitable forest fragments (beeches and oaks), in the Sierra de Ayllón in central Spain. Variables related to landscape attributes of the remnant forest patches such as size and connectivity and also the nature of the matrix or tree species had no significant effects on the genetic diversity of L. pulmonaria. Values of genetic diversity (Nei's) were only affected by habitat quality estimated as the age patches. Most of the variation (76%) in all populations was observed at the smallest sampled unit (plots). Using multiple regression analysis, we found that habitat quality is more important in explaining the genetic structure of the L. pulmonaria populations than spatial distance. The relatively high level of genetic diversity of the species in old forest patches regardless of patch size indicates that habitat quality in a highly structured forest stand determines the population size and distribution pattern of this species and its associated lichen community. Thus, conservation programmes of Mediterranean mountain forests have to prioritize area and habitat quality of old forest patche