  We propose that a magnetar could be formed during the core collapse of
massive stars or coalescence of two normal neutron stars, through collecting
and inheriting the magnetic fields magnified by hyperaccreting disk. After the
magnetar is born, its dipole magnetic fields in turn have a major influence on
the following accretion. The decay of its toroidal field can fuel the
persistent X-ray luminosity of either an SGR or AXP; however the decay of only
the poloidal field is insufficient to do so.
