The male-sterile ms2 mutant has been known for 40 years and has become extremely important in the commercial production of wheat. However, the gene responsible for this phenotype has remained unknown. Here we report the map-based cloning of the Ms2 gene. The Ms2 locus is remarkable in several ways that have implications in basic biology. Beyond having no functional annotation, barely detectable transcription in fertile wild-type wheat plants, and accumulated destructive mutations in Ms2 orthologs, the Ms2 allele in the ms2 mutant has acquired a terminal-repeat retrotransposon in miniature (TRIM) element in its promoter. This TRIM element is responsible for the anther-specific Ms2 activation that confers male sterility. The identification of Ms2 not only unravels the genetic basis of a historically important breeding trait, but also shows an example of how a TRIM element insertion near a gene can contribute to genetic novelty and phenotypic plasticity.