The origin of the Mg II absorption-line systems is analyzed from the p
oint of view of the ionization mechanism prevailing in the region. The
column densities derived from the observed equivalent widths of Mg II
, Mg I, C IV, and C II lines are compared to theoretical values obtain
ed from photoionization models. Two kinds of models are considered: (a
) H II region ionized by a hot star, if the absorption lines are assoc
iated with star-forming regions, and (b) diluted gas ionized by the in
tegrated background radiation of QSOs, if a halo origin is adopted. Tw
enty absorption systems have been analyzed. For most of them the H II
region models that are consistent are those in which the absorption re
gion is matter-bounded, ionized by an O4 star, with hydrogen density l
ess than 10 cm-3 and subsolar abundances. On the other hand, halo mode
ls do not give a unique solution, since the systems could be roughly f
itted by two kinds of models, depending on the input parameters (ioniz
ation parameter, optical depth at the Lyman limit, and chemical compos
ition). In addition, the photoionization models cannot consistently fi
t the data if the line absorption systems are associated with clouds i
n the halo, unless a complementary energy source is present.