Considerable attention has recently been focussed on the potential involvement of DNA methylation in regulating gene expression in cnidarians. Much of this work has been centred on corals, in the context of changes in methylation perhaps facilitating adaptation to higher seawater temperatures and other stressful conditions. Although first proposed more than 30 years ago, the possibility that DNA methylation systems function in protecting animal genomes against the harmful effects of transposon activity has largely been ignored since that time. Here we show that transposons are specifically targeted by the DNA methylation system in cnidarians, and that the youngest transposons (i.e. those most likely to be active) are most highly methylated. Transposons in longer and highly active genes were preferentially methylated and, as transposons aged, methylation levels declined, reducing the potentially harmful side-effects of CpG methylation. In Cnidaria and a range of other invertebrates, correlation between the overall extent of methylation and transposon content was strongly supported. Present transposon burden is the dominant factor in determining overall level of genomic methylation in a range of animals that diverged in or before the early Cambrian, suggesting that genome defence represents the ancestral role of CpG methylation.