F-type ATP synthases, central energy conversion machines of the cell synthesize adenosine triphosphate (ATP) using an electrochemical gradient across the membrane and, reversely, can also hydrolyze ATP to pump ions across the membrane, depending on cellular conditions such as ATP concentration. To prevent wasteful ATP hydrolysis, mammalian and bacterial ATP synthases possess different regulatory mechanisms. In bacteria, a low ATP concentration induces a conformational change in the ε subunit from the down- to up-states, which inhibits ATP hydrolysis. Moreover, the conformational change of the ε subunit depends on Mg(2+) concentration in some bacteria such as Bacillus subtilis, but not in others. This diversity makes the ε subunit a potential target for antibiotics. Here, performing molecular dynamics simulations, we identify the Mg(2+) binding site in the ε subunit from B. subtilis as E59 and E86. The free energy analysis shows that the first-sphere bi-dentate coordination of the Mg(2+) ion by the two glutamates is the most stable state. In comparison, we also clarify the reason for the absence of Mg(2+) dependency in the ε subunit from thermophilic Bacillus PS3, despite the high homology to that from B. subtilis. Sequence alignment suggests that this Mg(2+) binding motif is present in the ε subunits of some pathogenic bacteria. In addition we discuss strategies to stabilize an isolated ε subunit carrying the Mg(2+) binding motif by site directed mutagenesis, which also can be used to crystallize Mg(2+) dependent ε subunits in future.