Magnetars are regarded as the most magnetized neutron stars in the Universe. Aiming to unveil what kinds of stars and supernovae can create magnetars, we have performed a state-of-the-art spatially resolved spectroscopic X-ray study of the supernova remnants (SNRs) Kes 73, RCW 103, and N49, which host magnetars 1E 1841-045, 1E 161348-5055, and SGR 0526-66, respectively. The three SNRs are O- and Ne-enhanced and are evolving in the interstellar medium with densities of >1--2 cm$^{-3}$. The metal composition and dense environment indicate that the progenitor stars are not very massive. The progenitor masses of the three magnetars are constrained to be < 20 Msun (11--15 Msun for Kes 73, < 13 Msun for RCW 103, and ~13 --17 Msun for N49). Our study suggests that magnetars are not necessarily made from very massive stars, but originate from stars that span a large mass range. The explosion energies of the three SNRs range from $10^{50}$ erg to ~2$times 10^{51}$ erg, further refuting that the SNRs are energized by rapidly rotating (millisecond) pulsars. We report that RCW 103 is produced by a weak supernova explosion with significant fallback, as such an explosion explains the low explosion energy (~$10^{50}$ erg), small observed metal masses ($M_{rm O}sim 4times 10^{-2}$ Msun and $M_{rm Ne}sim 6times 10^{-3}$ Msun), and sub-solar abundances of heavier elements such as Si and S. Our study supports the fossil field origin as an important channel to produce magnetars, given the normal mass range ($M_{rm ZAMS} < 20$ Msun) of the progenitor stars, the low-to-normal explosion energy of the SNRs, and the fact that the fraction of SNRs hosting magnetars is consistent with the magnetic OB stars with high fields.