The electronic and structural properties of different members of the Ni-Mn-Ga family calculated by ab initio density functional theory are discussed. From total energy calculations, we show that the martensitic phase is the stable low temperature phase. Moreover, occurrence of ferromagnetic and paramagnetic martensitic phases for Ni2MnGa and Ni2.25Mn0.75Ga, respectively, are explained. Modifications in the density of states near the Fermi level EF are observed across the martensitic transition for Ni2MnGa, as well as in Mn2NiGa. While Ni2MnGa is ferromagnetic, we find Mn2NiGa to be ferrimagnetic. The calculated lattice constants and the magnetic moments are in good agreement with experiment.