Speciation and the maintenance of recently diverged species has been subject of intense research in evolutionary biology for decades. Although the concept of ecological speciation has been accepted, its mechanisms and genetic bases are still under investigation. Here, we present a mechanism for speciation that is orchestrated and strengthened by parasite communities acting on polymorphic genes of the immune system. In vertebrates, these genes have a pleiotropic role with regard to parasite resistance and mate choice. In contrasting niches, parasite communities differ and thus the pools of alleles of the adapted major histocompatibility complex (MHC) also differ between niches. Mate choice for the best-adapted MHC genotype will favour local adaptations and will accelerate separation of both populations: thus immune genes act as pleiotropic speciation genes –‘magic traits’. This mechanism should operate not only in sympatric populations but also under allopatry or parapatry. Each individual has a small subset of the many MHC alleles present in the population. If all individuals could have all MHC alleles from the pool, MHC-based adaptation is neither necessary nor possible. However, the typically small optimal individual number of MHC loci thus enables MHC-based speciation. Furthermore, we propose a new mechanism selecting against species hybrids. Hybrids are expected to have super-optimal individual MHC diversity and should therefore suffer more from parasites in all habitats.