We report results of textit{ab-initio} calculations of the ferromagnetic Heusler alloy Ni-Mn-Ga. Particular emphasis is placed on the stability of the low temperature tetragonal structure with $c/a = 0.94$. This structure cannot be derived from the parent L2$_1$ structure by a simple homogeneous strain associated with the soft elastic constant $C$. In order to stabilise the tetragonal phase, one has to take into account shuffles of atoms, which form a wave-like pattern of atomic displacements with a well defined period (modulation). While the modulation is related to the soft acoustic [110]-TA$_2$ phonon mode observed in Ni$_2$MnGa, we obtain additional atomic shuffles, which are related to acoustic-optical coupling of the phonons in Ni$_2$MnGa. In addition, we have simulated an off-stoichiometric systems, in which 25 % of Mn atoms are replaced by Ni. The energy of this structure also exhibits a local minimum at $c/a = 0.94$. This allows us to conclude that both shuffles and atomic disorder stabilize the $c/a = 0.94$ structure. In both cases the stability seems to be associated with a dip in the minority-spin density of states (DOS) at the Fermi level, being related to the formation of hybrid states of Ni-textit{d} and Ga-textit{p} minority-spin orbitals.