The ruff is a Palearctic wader with a spectacular lekking behavior where highly ornamented males compete for females. This bird has one of the most remarkable mating systems in the animal kingdom, comprising three different male morphs (independents, satellites and faeders) that differ in behavior, plumage color and body size. Remarkably, the satellite and faeder morphs are controlled by dominant alleles. Here we have used whole-genome sequencing and resolved the enigma of how such complex phenotypic differences can have a simple genetic basis. The Satellite and Faeder alleles are both associated with a 4.5-Mb inversion that occurred about 3.8 million years ago. We propose an evolutionary scenario where the Satellite chromosome arose by a rare recombination event about 500,000 years ago. The ruff mating system is the result of an evolutionary process in which multiple genetic changes contributing to phenotypic differences between morphs have accumulated within the inverted region.