Mammalian genomes are threatened with gene inactivation and chromosomal scrambling by recombination between repeated sequences such as mobile genetic elements and pseudogenes. We present and test a model for a defensive strategy based on the methylation and subsequent mutation of CpG dinucleotides in those DNA duplications that create uninterrupted homologous sequences longer than about 0.3 kilobases. The model helps to explain both the diversity of CpG frequencies in different genes and the persistence of gene fragmentation into exons and introns.