In natural populations, allelic diversity of the major histocompatibility complex (MHC) is commonly interpreted as resulting from positive selection in varying spatiotemporal pathogenic landscapes. Composite pathogenic landscape data are, however, rarely available. We studied the spatial distribution of allelic diversity at two MHC class II loci (DQA, DQB) in hares, Lepus capensis, along a steep ecological gradient in North Africa and tested the role of climatic parameters for the spatial distribution of DQA and DQB proteins. Climatic parameters were considered to reflect to some extent pathogenic landscape variation. We investigated historical and contemporary forces that have shaped the variability at both genes, and tested for differential selective pressure across the ecological gradient by comparing allelic variation at MHC and neutral loci. We found positive selection on both MHC loci and significantly decreasing diversity from North to South Tunisia. Our multinomial linear models revealed significant effects of geographical positions that were correlated with mean annual temperature and precipitation on the occurrence of protein variants, but no effects of co-occurring DQA or DQB proteins, respectively. Diversifying selection, recombination, adaptation to local pathogenic landscapes (supposedly reflected by climate parameters) and neutral demographic processes have shaped the observed MHC diversity and differentiation patterns.