Anomalous X-ray Pulsars and Soft Gamma-Ray Repeaters (SGRs) are young neutron stars characterized by high X-ray quiescent luminosities, outbursts, and, in the case of SGRs, sporadic giant flares. They are believed to be magnetars, that is neutron stars powered by ultra-strong magnetic fields. However, the diversity of their behaviours, and, especially, the observation of magnetar-like bursts from 'low-field' neutron stars, has been a theoretical puzzle. In the first part of the talk, I will discuss results of long-term MHD simulations which, by following the evolution of magnetic stresses within the neutron star crust, have allowed to relate the observed magnetar phenomenology to the physical properties of the neutron stars, and in particular to their age and magnetic field strength and topology. The dichotomy of 'high-B' field pulsars versus magnetars is naturally explained, and occasional outbursts from old, low B-field neutron stars are predicted. In the second part of the talk, I will discuss how observations of highly magnetized neutron stars can be handy tools in the cosmological domain, and in particular as a way to set constraints on the hypothetical particle 'axion'.