Structural and compositional changes in the Li-Mg-N-H system have been studied by probing the pressurecomposition isotherms at different hydrogenation/dehydrogenation stages. The results of X-ray diffractometryand Fourier transform infrared spectroscopy show that LiNH2 and a ternary imide with the composition Li2Mg2(NH)3 are reversibly formed and consumed in the hydrogen absorption/desorption processes. Chemicalreactions have been proposed for hydrogen absorption and desorption, accordingly. The formation of solidsolutions in the system is assumed based on structure and phase analysis.