Nitride (N3-) or cyanamide (CN22-) based mixed-anion compounds stand as attractive materials due to their unique properties derived from the binary or multiple anions, although their synthesis remains challenging in incorporating the N3- or CN22- anions safely. This work highlights the first demonstration of in situ single phase formation of a LaCl(CN2) mixed-anion compound from a stable single source precursor, melamine modified with LaCl3 preparable under aqueous conditions. The in situ formation of LaCl(CN2) involves the chemical modification of melamine with LaCl3 to form a complex. Upon heating of the precursor under N2 flowing, this complex generates cyanamide species around 400 °C, which react with LaCl3 and nonsublimated melamine to afford a binary LaCl(CN2)/g-C3N4 composite. Further pyrolysis at 800 °C decomposes the g-C3N4 counterpart, resulting in the LaCl(CN2) single-phase formation. The electronic properties of the precursor-derived single phase LaCl(CN2) were studied by the density functional theory calculation and UV-vis spectroscopy combined with X-ray photoelectron spectroscopy analyses and characterized by measuring 4.7, 1.8, and -2.9 eV for the band gap energy, the valence band maximum, and the conduction band minimum relative to Fermi energy, respectively. This study paves the way for exploring various cyanamide-based mixed anion compounds, advancing their potential applications in various fields.