When magnesium nitride reacts with water, it gives off ammonia gas. According to ACS Publications, magnesium nitride reacting with water is a convenient source of ammonia.
Magnesium nitride is an inorganic compound that is a mixture of magnesium and nitrogen. It is considered a nitride, which is a combination of nitrogen and an electropositive element like a metal; in this case, magnesium is the electropositive element. Magnesium is one of the most reactive metals, which means that it easily reacts with other metals, acids and even the nitrogen in the air.
Once magnesium nitrate reacts with water, it releases solid magnesium hydroxide and ammonia, a pungent colorless gas. The magnesium hydroxide in its solid form is known as brucite. In its liquid form, magnesium hydroxide is commonly referred to as milk of magnesia because of its milk-like appearance. Magnesium hydroxide is an alkaline substance that interferes with the uptake of iron and folic acid, and it is commonly found in laxatives and antacids, which are used to neutralize stomach acid. It is also found in deodorants as an antiperspirant.
Ammonia is a combination of hydrogen and nitrogen. Chemically, it is written as NH3. Ammonia is used in several cleaning products and in the synthesis of pharmaceutical drugs. Although it is used quite frequently, ammonia is considered hazardous and caustic.