Background: A broad capacity for deliberate self-regulation plays a key role in emotion regulation. This longitudinal investigation from infancy to preschool age examines genotype by environment (G x E) interaction in the development of self-regulation, using molecular measures of children's genotypes and observed measures of the quality of early mother-child relationship, as reflected in attachment organization in infancy. Methods: In 89 children, we assessed the polymorphism in the serotonin transporter gene (5-HTTLPR, "ss/sl" vs. "ll" allele status), security of attachment to mothers at 15 months in the Strange Situation, and children's ability for self-regulation at 25, 38, and 52 months, using behavioral batteries of tasks that called for deliberately suppressing a dominant response and performing instead a sub-dominant response. Results: There was a robust G x E interaction between genetic risk and the quality of early relationship. Among children who carried a short 5-HTTLPR allele ("ss/sl"), those who were insecurely attached developed poor regulatory capacities, but those who were securely attached developed as good regulatory capacities as children who were homozygotic for the long allele ("ll"). There was no effect of security for "ll" homozygotes. Conclusions: Those findings, consistent with diathesis-stress model, bridge research on self-regulation in typically developing children with research on non-human primates and research on psychopathology. They also indicate that a secure attachment relationship can serve as a protective factor in the presence of risk conferred by a genotype.