Melatonin is an ancient molecule that can be traced back to the origin of life. Melatonin's initial function was likely that as a free radical scavenger. Melatonin presumably evolved in bacteria; it has been measured in both α-proteobacteria and in photosynthetic cyanobacteria. In early evolution, bacteria were phagocytosed by primitive eukaryotes for their nutrient value. According to the endosymbiotic theory, the ingested bacteria eventually developed a symbiotic association with their host eukaryotes. The ingested α-proteobacteria evolved into mitochondria while cyanobacteria became chloroplasts and both organelles retained their ability to produce melatonin. Since these organelles have persisted to the present day, all species that ever existed or currently exist may have or may continue to synthesize melatonin in their mitochondria (animals and plants) and chloroplasts (plants) where it functions as an antioxidant. Melatonin's other functions, including its multiple receptors, developed later in evolution. In present day animals, via receptor-mediated means, melatonin functions in the regulation of sleep, modulation of circadian rhythms, enhancement of immunity, as a multifunctional oncostatic agent, etc., while retaining its ability to reduce oxidative stress by processes that are, in part, receptor-independent. In plants, melatonin continues to function in reducing oxidative stress as well as in promoting seed germination and growth, improving stress resistance, stimulating the immune system and modulating circadian rhythms; a single melatonin receptor has been identified in land plants where it controls stomatal closure on leaves. The melatonin synthetic pathway varies somewhat between plants and animals. The amino acid, tryptophan, is the necessary precursor of melatonin in all taxa. In animals, tryptophan is initially hydroxylated to 5-hydroxytryptophan which is then decarboxylated with the formation of serotonin. Serotonin is either acetylated to
N
-acetylserotonin or it is methylated to form 5-methoxytryptamine; these products are either methylated or acetylated, respectively, to produce melatonin. In plants, tryptophan is first decarboxylated to tryptamine which is then hydroxylated to form serotonin.