Many endangered species persist as a series of isolated populations, with some populations more genetically diverse than others. If climate change disproportionately threatens the most diverse populations, the species' ability to adapt (and hence its long-term viability) may be affected more severely than would be apparent by its numerical reduction. In the present study, we combine genetic data with modelling of species distributions under climate change to document this situation in an endangered lizard (Eulamprus leuraensis) from montane southeastern Australia. The species is known from only about 40 isolated swamps. Genetic diversity of lizard populations is greater in some sites than others, presumably reflecting consistently high habitat suitability over evolutionary time. Species distribution modelling suggests that the most genetically diverse populations are the ones most at risk from climate change, so that global warming will erode the species' genetic variability faster than it curtails the species' geographic distribution.