The Mg i emission lines at 7 and 12 ¡im provide a sensitive measure of the magnetic and electric field strengths in the layers of the solar atmosphere where the observed emission originates. Hence it is important to know how and where these lines are formed. Their strong limb brightening suggests a chromospheric origin; however, theoretical studies by Lemke and Holweger and by Hoang-Binh, and observations by Deming et al., suggest an origin at or below the temperature minimum, with the emission being produced by the underpopulation of lower atomic levels relative to the upper ones. Such underpopulations are caused by radiative depopulation of lower levels, together with collisional coupling of higher levels with the Mg n continuum. We investigate these effects with a 41 level atomic model, including collisions with hydrogen atoms as well as with electrons, and including the charge exchange process Mg + + H(n)<-► Mg(n/) + H + between magnesium and hydrogen. Using an average quiet Sun atmospheric model, we calculate emission-line profiles that resemble the observed ones, that is, broad absorption troughs with narrow central emission, and significant limb brightening. The charge exchange rates are significant, but the effects of high-rc coupling between Mg and Mg + (due to collisions with electrons and with hydrogen atoms) together with radiative losses between low-rc transitions are of greater importance. We confirm that the emission cores are formed no higher than the temperature minimum region, and that the emission is caused by non-LTE effects rather than by the chromospheric temperature rise. This photospheric origin explains why the brightness temperature of the trough, or minimum intensity in the line wings, is unrelated to the temperature minimum between the photosphere and chromosphere. The model calculations indicate that the line core is sensitive to magnetic fields located almost 400 km above those measured in ordinary magnetograms; the gas pressure decreases 20-fold between these two heights. The electron density decreases by a factor of 8 between the heights at which the trough and emission core originate, consistent with observed Stark shifts. The behavior of the emission lines as seen during a total solar eclipse should provide a strong test of these model calculations and inferred formation mechanisms. Subject headings : line formation-Sun : atmosphere-Sun : eclipses-Sun : magnetic fields 19 91ApJ.. .37 9L. .79C L80 CHANG ET AL. Vol. 379