EDTA is a chelator of divalent cations, particularly of magnesium (Mg2+). As these ions are necessary co-factors for many enzymes, including contaminant nucleases, the role of the EDTA is to protect the nucleic acids against enzymatic degradation. But since Mg2+ is also a co-factor for many useful DNA-modifying enzymes such as restriction enzymes and DNA polymerases, its concentration in TBE or TAE buffers is generally kept low (typically at around 1 mM).