Aim: The historical causes responsible for the wide distribution of terricolous, crustose lichenized fungi across the Mediterranean Basin and the Canary Islands have never been explored. Here, we used the terricolous, circum-Mediterranean/Macaronesian species Buellia zoharyi (Caliciaceae, Ascomycota) to infer the time frame, and the climatic, geological and ecological factors influencing the origin and current spatial distribution of this species. Location: Mediterranean Basin and Canary Islands. Methods: Data from two nuclear markers (nrITS and tef1) obtained from 226 specimens of 23 populations covering the entire distribution range of B. zoharyi were used to calculate genetic diversity indices and haplotype networks and to investigate population size changes and structure. Three secondary calibrations were used to estimate the timing of the divergence of B. zoharyi from its hypothesized sister species, B. elegans, and the diversification of B. zoharyi. Results: We found low nucleotide diversity and two geographically differentiated haplogroups, with a contact zone in the Iberian Peninsula. The three dating approaches established wide temporal windows for the divergence of B. zoharyi from B. elegans (Eocene-Pliocene) and its diversification (Miocene-Pleistocene). These intervals overlap with the origin and diversification ages found in other lichen-forming fungi and vascular plants inhabiting the Mediterranean region. Main conclusions: In the context of lichen biogeography, our results support ecological specialization as well as geological and climatic events as drivers of the evolutionary history of B. zoharyi in the Mediterranean. In particular, the combined effects of the Messinian salinity crisis and the subsequent Zanclean Flood on the availability of gypsum soils in the Mediterranean Basin, as well as the Quaternary climatic oscillations, seem to have collectively shaped the amount and distribution of B. zoharyi population genetic diversity. K E Y W O R D S biogeography, Buellia zoharyi, ecological speciation, gypsum soils, Messinian salinity crisis, Zanclean Flood