Anthrax edema factor (EF) raises host intracellular cAMP to pathological levels through a calcium-calmodulin (CaM)-dependent adenylyl cyclase activity. Here we report the structure of EF.CaM in complex with its reaction products, cAMP and PP(i). Mutational analysis confirmed the interaction of EF with cAMP and PP(i) as depicted in the structural model. While both cAMP and PP(i) have access to solvent channels to exit independently, PP(i) is likely released first. EF can synthesize ATP from cAMP and PP(i), and the estimated rate constants of this reaction at two physiologically relevant calcium concentrations were similar to those of adenylyl cyclase activity of EF. Comparison of the conformation of adenosine in the structures of EF.CaM.cAMP.PP(i) with EF.CaM.3.dATP revealed about 160 degrees rotation in the torsion angle of N-glycosyl bond from the +anti conformation in 3.dATP to -syn in cAMP; such a rotation could serve to distinguish against substrates with the N-2 amino group of purine. The catalytic rate of EF for ITP was about 2 orders of magnitude better than that for GTP, supporting the potential role of this rotation in substrate selectivity of EF. The anomalous difference Fourier map revealed that two ytterbium ions (Yb(3+)) could bind the catalytic site of EF.CaM in the presence of cAMP and PP(i), suggesting the presence of two magnesium ions at the catalytic site of EF. We hypothesize that EF could use a "histidine and two-metal ion" hybrid mechanism to facilitate the cyclization reaction.