The combination of Mg magnesium and Cl chlorine atoms forms an inorganic solid called magnesium chloride MgCl2 . This compound is an ionic solid, as it is formed by the transfer of electrons from the metal Mg to the non-metal Cl , resulting in the formation of positively charged magnesium ions Mg2+ and negatively charged chloride ions Cl- . These ions are held together by strong electrostatic forces in a crystal lattice structure.