Electronic structure and stability have been detd. from first-principles calcns. for the magnesium nitride-fluorides Mg2NF and Mg3NF3, as well as for the binaries MgF2 and Mg3N2. These calcns. show that the compds. are ionic to a first approxn. In the nitride-fluorides the valence bands are mainly detd. by the N 2p states while the F 2p states are well sepd. from the N 2p bands and lie 3.5-5.1 eV below the Fermi level. The bottom of the conduction bands is detd. by the empty 3s states of the anions. The energy gap decreases steadily with increasing nitrogen content.