Summary: We have generated a large heterogenous stock population by intercrossing eight divergent pig breeds for multiple generations. We have analyzed the composition of the intestinal microbiota at different ages and anatomical locations in > 1,000 6 th - and 7 th - generation animals. We show that, under conditions of exacerbated genetic yet controlled environmental variability, microbiota composition and abundance of specific taxa (including Christensenellaceae ) are heritable in this monogastric omnivore. We fine-map a QTL with major effect on the abundance of Erysipelotrichaceae to chromosome 1q and show that it is caused by a common 2.3-Kb deletion inactivating the ABO acetyl-galactosaminyl-transferase gene. We show that this deletion is a trans-species polymorphism that is ≥3.5 million years old and under balancing selection. We demonstrate that it acts by decreasing the concentrations of N-acetyl-galactosamine in the cecum thereby reducing the abundance of Erysipelotrichaceae strains that have the capacity to import and catabolize N-acetyl-galactosamine.