The tiny contribution of cadmium (Cd) to the composition of the earth's crust contrasts with its high biological significance, owing mainly to the competition of Cd with the essential zinc (Zn) for suitable metal binding sites in proteins. In this context it was speculated that in several animal lineages, the protein family of metallothioneins (MTs) has evolved to specifically detoxify Cd. Although the multi-functionality and heterometallic composition of MTs in most animal species does not support such an assumption, there are some exceptions to this role, particularly in animal lineages at the roots of animal evolution. In order to substantiate this hypothesis and to further understand MT evolution, we have studied MTs of different snails that exhibit clear Cd-binding preferences in a lineage-specific manner. By applying a metallomics approach including 74 MT sequences from 47 gastropod species, and by combining phylogenomic methods with molecular, biochemical, and spectroscopic techniques, we show that Cd selectivity of snail MTs has resulted from convergent evolution of metal-binding domains that significantly differ in their primary structure. We also demonstrate how their Cd selectivity and specificity has been optimized by the persistent impact of Cd through 430 million years of MT evolution, modifying them upon lineage-specific adaptation of snails to different habitats. Overall, our results support the role of Cd for MT evolution in snails, and provide an interesting example of a vestigial abiotic factor directly driving gene evolution. Finally, we discuss the potential implications of our findings for studies devoted to the understanding of mechanisms leading to metal specificity in proteins, which is important when designing metal-selective peptides.