Involved in chlorophyll biosynthesis. Catalyzes the insertion of magnesium ion into protoporphyrin IX to yield Mg-protoporphyrin IX. The reaction takes place in two steps, with an ATP-dependent activation followed by an ATP-dependent chelation step. ATP + H2O + Mg(2+) + protoporphyrin IX = ADP + 3 H(+) + Mg-protoporphyrin IX + phosphate Porphyrin-containing compound metabolism; chlorophyll biosynthesis. The magnesium chelatase complex is a heterotrimer consisting of subunits CHLI, CHLD, AND CHLH. Homozygous KO plants are chlorotic lethal. Belongs to the Mg-chelatase subunits D/I family.