We study the origin of the gap and the role of chemical composition in the half-ferromagnetic Heusler alloys using the full-potential screened KKR method. In the paramagnetic phase the C1 b compounds, like NiMnSb, present a gap. Systems with 18 valence electrons, Zt, per unit cell, like CoTiSb, are semiconductors, but when Zt > 18 antibonding states are also populated, thus the paramagnetic phase becomes unstable and the half-ferromagnetic one is stabilized. The minority occupied bands accommodate a total of nine electrons and the total magnetic moment per unit cell in µB is just the difference between Zt and 2 × 9. While the substitution of the transition metal atoms may preserve the half-ferromagnetic character, substituting the sp atom results in a practically rigid shift of the bands and the loss of half-metallicity. Finally we show that expanding or contracting the lattice parameter by 2% preserves the minority-spin gap.