Local adaptation is an important process contributing to population differentiation which can occur in continuous or isolated populations connected by various amounts of gene flow. The willow warbler (Phylloscopus trochilus) is one of the most common songbirds in Fennoscandia. It has a continuous breeding distribution where it is found in all forested habitats from sea level to the tree line and therefore constitutes an ideal species for the study of locally adapted genes associated with environmental gradients. Previous studies in this species identified a genetic marker (AFLP-WW1) that showed a steep north-south cline in central Sweden with one allele associated with coastal lowland habitats and the other with mountainous habitats. It was further demonstrated that this marker is embedded in a highly differentiated chromosome region that spans several megabases. In the present study, we sampled 2,355 individuals at 128 sites across all of Fennoscandia to study the geographic and climatic variables associated with the allele frequency distributions of WW1. Our results demonstrate that 1) allele frequency patterns significantly differ between mountain and lowland populations, 2) these allele differences coincide with extreme temperature conditions and the short growing season in the mountains, and milder conditions in coastal areas, and 3) the northern-allele or "altitude variant" of WW1 occurs in willow warblers that occupy mountainous habitat regardless of subspecies. Finally these results suggest that climate may exert selection on the genomic region associated with these alleles and would allow us to develop testable predictions for the distribution of the genetic marker based on climate change scenarios.