Conflicting results on the La–Ni phase diagram still exist about the equilibrium state of intermetallic compounds such as La2Ni7 and La5Ni19. Moreover, the substitution of the rare earth by Mg element increases doubts about the phase stability in the La–Mg–Ni ternary system. In this paper, the stability of the AB
y
phase, where y = (5n + 4)/(n + 2) and n = 1–5, has been studied in the ternary system, with A = La, Mg and B = Ni. The AB
y
phase formation is explained by the stacking along the c axis of n × [AB
5] + [A
2
B
4] units following two possible sequences, one of rhombohedral and the other of hexagonal symmetry, called, respectively, 3R and 2H. Using Density Functional Theory (DFT) calculations, origins of the observed polymorphic features will be highlighted. A systematic study of every ordered configuration of (La,Mg)Ni3, (La,Mg)2Ni7, (La,Mg)5Ni19, some (La,Mg)6Ni24, and the hypothetical La7Ni29 is presented. From the estimation of the heats of formation, the preferential A site occupation by La and Mg is discussed among the various A crystallographic available sites. Depending on the AB
y
compound, results allow us to predict which of the 3R or 2H symmetry is the most stable at 0 K as a function of the La–Mg–Ni elemental composition. Crystallographic properties are compared to available experimental results.