Answer
Ions of lithium and magnesium ($\mathrm{Li}^{+}$ and $\mathrm{Mg}$ $^{2+}$) have high charge densities and are strongly polarizing, which in turn provides the ability to stabilize the $\mathrm{N}^{3-}$ anion as follows:
$3 \mathrm{Li}(\mathrm{s})+\frac {1} {2} \mathrm{N}_{2}(\mathrm{g}) \rightarrow \mathrm{Li}_{3} \mathrm{N}(\mathrm{s})$
$3 \mathrm{Mg}(\mathrm{s})+\mathrm{N}_{2}(\mathrm{g}) \rightarrow \mathrm{Mg}_{3} \mathrm{N}_{2}(\mathrm{s}) $
Work Step by Step
See answer.