© 2014 John Wiley & Sons Ltd. Major histocompatibility complex (MHC) gene polymorphism is thought to be driven by host-parasite co-evolution, but the evidence for an association between the selective pressure from parasites and the number of MHC alleles segregating in a population is scarce and inconsistent. Here, we characterized MHC class I polymorphism in a lizard whose habitat preferences (rock outcrops) lead to the formation of well-defined and stable populations. We investigated the association between the load of ticks, which were used as a proxy for the load of pathogens they transmit, and MHC class I polymorphism across populations in two types of habitat: undisturbed reserves and agricultural land. We hypothesized that the association would be positive across undisturbed reserve populations, but across fragmented agricultural land populations, the relationship would be distorted by the loss of MHC variation due to drift. After controlling for habitat, MHC diversity was not associated with tick number, and the habitats did not differ in this respect. Neither did we detect a difference between habitats in the relationship between MHC and neutral diversity, which was positive across all populations. However, there was extensive variation in the number of MHC alleles per individual, and we found that tick number was positively associated with the average number of alleles carried by lizards across reserve populations, but not across populations from disturbed agricultural land. Our results thus indicate that local differences in selection from parasites may contribute to MHC copy number variation within species, but habitat degradation can distort this relationship.