Several plant species can tolerate high concentrations of selenium in the environment, and they accumulate organoselenium compounds. One of these compounds is Se-methylselenocysteine, synthesized by a number of species from the genus Astragalus (Fabaceae), like A. bisulcatus. An enzyme has been previously isolated from this organism that catalyzes methyl transfer from S-adenosylmethionine to selenocysteine. To elucidate the role of the enzyme in selenium tolerance, the cDNA coding for selenocysteine methyltransferase from A. bisulcatus was cloned and sequenced. Data base searches revealed the existence of several apparent homologs of hitherto unassigned function. The gene for one of them, yagD from Escherichia coli, was cloned, and the protein was overproduced and purified. A functional analysis showed that the YagD protein catalyzes methylation of homocysteine, selenohomocysteine, and selenocysteine with S-adenosylmethionine and S-methylmethionine as methyl group donors. S-Methylmethionine was now shown to be also the physiological methyl group donor for the A. bisulcatus selenocysteine methyltransferase. A model system was set up in E. coli which demonstrated that expression of the plant and, although to a much lesser degree, of the bacterial methyltransferase gene increases selenium tolerance and strongly reduces unspecific selenium incorporation into proteins, provided that S-methylmethionine is present in the medium. It is postulated that the selenocysteine methyltransferase under selective pressure developed from an S-methylmethionine-dependent thiol/selenol methyltransferase.