BACKGROUND: The hypomorphic variant rs11209026-A in the IL23R gene provides significant protection against immune-related diseases in Europeans, notably inflammatory bowel diseases (IBD). Today, the A-allele occurs with an average frequency of 5% in Europe. METHODS: This study comprised 251 ancient genomes from Europe spanning over 14,000 years. In these samples, the investigation focused on admixture-informed analyses and selection scans of rs11209026-A and its haplotypes. FINDINGS: rs11209026-A was found at high frequencies in Anatolian Farmers (AF, 18%). AF later introduced the allele into the ancient European gene-pool. Subsequent admixture caused its frequency to decrease and formed the current southwest-to-northeast allele frequency cline in Europe. The geographic distribution of rs11209026-A may influence the gradient in IBD incidence rates that are highest in northern and eastern Europe. INTERPRETATION: Given the dramatic changes from hunting and gathering to agriculture during the Neolithic, AF might have been exposed to selective pressures from a pro-inflammatory lifestyle and diet. Therefore, the protective A-allele may have increased survival by reducing intestinal inflammation and microbiome dysbiosis. The adaptively evolved function of the variant likely contributes to the high efficacy and low side-effects of modern IL-23 neutralisation therapies for chronic inflammatory diseases. FUNDING: German Research Foundation (EXC 2167 390884018 and EXC 2150 390870439).