The origin and maintenance of polymorphism in major histocompatibility complex (MHC) genes in natural populations is still unresolved. Sexual selection, frequency-dependent selection by parasites and pathogens, and heterozygote advantage have been suggested to explain the maintenance of high allele diversity at MHC genes. Here we argue that there are two (non-exclusive) strategies for MHC-related sexual selection, representing solutions to two different problems: inbreeding avoidance and parasite resistance. In species prone to inadvertent inbreeding, partners should prefer dissimilar MHC genotypes to similar ones. But if the goal is to maximize the resistance of offspring towards potential infections, the choosing sex should prefer mates with a higher diversity of MHC alleles. This latter strategy should apply when there are several MHC loci, as is the case in most vertebrates. We tested the relative importance of an 'allele counting' strategy compared to a disassortative mating strategy using wild-caught three-spined sticklebacks (Gasterosteus aculeatus) from an interconnected system of lakes. Here we show that gravid female fish preferred the odour of males with a large number of MHC class-IIB alleles to that of males with fewer alleles. Females did not prefer male genotypes dissimilar to their own.