An ab initio study of endohedral complexes of C-60 and its Si and Ge analogues with first, second, third, and fourth row alkali metal and halogen ions is performed using the multiplicative integral approximation and the 3-21 G basis set (3-21+G for the halogen ions). The properties of the endohedral ions are studied, and complexation energies are calculated using the counterpoise correction for the basis set superposition error. An (approximate) analytical expression for this complexation energy is derived within the framework of density-functional theory. The complexation energy sequences are rationalized using this expression and the properties of the fullerene cages, such as the electrostatic potential within the cage and the average distance of the electrons from the cage center. Besides electrostatic effects, i.e., the interaction of the ion with the electrostatic potential within the cage, the influence of the cage and guest-ion hardnesses on the stabilization energies are also investigated: a local hard and soft acids and bases principle can be invoked to explain the complexation energies within alkali metal and halogen ion series.