When in a supernova a star collapses to a neutron star, its magnetic field increases dramatically in strength. Duncan and Thompson calculated that the magnetic field of a neutron star, normally an already enormous 1012 tesla could under certain circumstances grow even larger, to about 1015 tesla. Such a highly magnetic neutron star is called a magnetar.
In the outer layers of a magnetar, which consist of a plasma of heavy elements (mostly iron), this causes tension which leads to 'starquakes'. These seismic vibrations are extremely energetic, and result in a burst of X-ray and gamma ray radiation. To astronomers, such an object is known as a soft gamma repeater.
It is estimated that about 1 in 10 supernova explosions results in a magnetar rather than a more standard neutron star or pulsar. It only happens when the star already has a fast rotation and strong magnetic field before the supernova. It is thought that a magnetar's magnetic field is created as a result of a convection-driven dynamo of hot nuclear matter in the neutron star's interior that operates in the first ten seconds or so of a neutron star's life. If the neutron star is initially rotating as fast as the period of convection, about ten milliseconds, then the convection currents are able to operate globally and transfer a significant amount of their kinetic energy into magnetic field strength. In slower-rotating neutron stars, the convection currents only form in local regions.
The life of a magnetar as a soft gamma repeater is short: The energy of these explosions slows the rotation (causing magnetars to rotate much more slowly than other neutron stars of a similar age) and lessens the electric field, and after only about 10,000 years the starquakes are over. After this, the star still radiates X-rays, forming an object known to astronomers as an anomalous X-ray pulsar (AXP). After yet another 10,000 years, it is completely quiet. At the moment (2000), 4 soft gamma repeaters and 6 anomalous X-ray pulsars are known.