BackgroundThe current large spectrum of sheep phenotypic diversity results from the combined product of sheep selection for different production traits such as wool, milk and meat, and its natural adaptation to new environments. In this study, we scanned the genome of 25 Sasi Ardi and 75 Latxa sheep from the Western Pyrenees for three types of regions under selection: (1) regions underlying local adaptation of Sasi Ardi semi-feral sheep, (2) regions related to a long traditional dairy selection pressure in Latxa sheep, and (3) regions experiencing the specific effect of the modern genetic improvement program established for the Latxa breed during the last three decades.ResultsThirty-two selected candidate regions including 147 annotated genes were detected by using three statistical parameters: pooled heterozygosity H, Tajima’s D, and Wright’s fixation index Fst. For Sasi Ardi sheep, chromosomes Ovis aries (OAR)4, 6, and 22 showed the strongest signals and harbored several candidate genes related to energy metabolism and morphology (BBS9, ELOVL3 and LDB1), immunity (NFKB2), and reproduction (H2AFZ). The major genomic difference between Sasi Ardi and Latxa sheep was on OAR6, which is known to affect milk production, with highly selected regions around the ABCG2, SPP1, LAP3, NCAPG, LCORL, and MEPE genes in Latxa sheep. The effect of the modern genetic improvement program on Latxa sheep was also evident on OAR15, on which several olfactory genes are located. We also detected several genes involved in reproduction such as ESR1 and ZNF366 that were affected by this selection program.ConclusionsNatural and artificial selection have shaped the genome of both Sasi Ardi and Latxa sheep. Our results suggest that Sasi Ardi traits related to energy metabolism, morphological, reproductive, and immunological features have been under positive selection to adapt this semi-feral sheep to its particular environment. The highly selected Latxa sheep for dairy production showed clear signatures of selection in genomic regions related to milk production. Furthermore, our data indicate that the selection criteria applied in the modern genetic improvement program affect immunity and reproduction traits.Electronic supplementary materialThe online version of this article (10.1186/s12711-018-0378-x) contains supplementary material, which is available to authorized users.