The microscopic mechanisms responsible for both the formation and coupling of magnetic moments in Heusler alloys (X2Mn Y) are identified. We find that the X atoms (e.g., Cu, Pd) serve primarily to determine the lattice constant, while the Y atoms (e.g., Al, In, Sb) mediate the interaction between the Mn d states. There is no significant direct interaction between the Mn atoms, but the occupied d states of Mn are delocalized by their strong interaction with the X-atom d states. The localized character of the magnetization results from the exclusion of minority-spin (defined locally) electrons from the Mn 3d shell. The coupling between the localized magnetic Mn moments can be described with the Heisenberg Hamiltonian and the sign of the exchange constants results from a competition between the intra-atomic magnetic energy and interatomic Y-atom mediated covalent interactions between the the Mn d states. These effects compete because the covalent mechanism is possible only for antiferromagnetic alignments, but necessarily reduces the magnitude of the local moments. The sensitive dependence of magnetic order on the occupation of the mediating p-d hybrid states accounts well for experiments by Webster in which this occupation is varied by alloying. Our analysis is based on self-consistent, spin-polarized energy-band calculations for Co2MnAl, Co2MnSn, Ni2MnSn, Cu2MnAl, Cu2MnSn, Pd2MnIn, Pd2MnSn, and Pd2MnSb, for both ferromagnetic and antiferromagnetic spin alignments. © 1983 The American Physical Society.