First-principles calculations have been performed for a variety of Ni 3 X (X = C, N) phases, as well as for NiX y (y = 0 to 1 3 ) solid solutions to clarify the persistent controversy regarding its magnetic state. The calculations show that the solid solution phases based on hexagonal-close-packed (hcp or ε-) Ni have relatively high stability for X concentrations greater than about 0.1 whereas the face-centered-cubic (fcc or γ -) Ni phases are favored for smaller X concentration. Hence, during carburization or nitridization of Ni, a phase transformation is to be expected. In spite of the close-packed nature of both hcp-and fcc-based solid solutions, X quenches the magnetization more effectively in fcc than in hcp-based solid solutions. These findings resolve many apparently contradictory experimental observations concerning C-and N-containing Ni alloys in the literature.