Stabilization of pentazolate anions in the high-pressure compounds Na2N5 and NaN5 and in the sodium pentazolate framework NaN5·N2.