  In this work we study the structure of neutron stars under the effect of a
poloidal magnetic field and determine the limiting highest magnetic field
intensity which still allows a satisfactory description of magnetic neutron
stars in the spherical symmetry regime. We describe different compositions of
stars (nucleonic, hyperonic, and hybrid), using three state-of-the-art
relativistic mean field models for the microscopic description of matter, which
are in agreement with experimental and observational data. The structure of
stars is described by the general relativistic solution of both Einstein's
field equations assuming a spherical symmetry, and Einstein-Maxwell's field
equations assuming an axi-symmetric deformation. We find a limiting magnetic
moment of the order of $2\times 10^{31}$Am$^2$, which corresponds to magnetic
fields of the order of 10$^{16}$ G at the surface, and $ \sim 10^{17}$ G at the
centre of the star, above which the deformation due to the magnetic field is
not negligible. We show that the intensity of the magnetic field developed in
the star depends on the EoS, and, for a given baryonic mass and fixed magnetic
moment, larger fields are attained with softer EoS. We also show that the
appearance of exotic degrees of freedom, such as hyperons or a quark core, is
disfavored in the presence of a very strong magnetic field. As a consequence, a
highly magnetized nucleonic star may suffer an internal conversion due to the
decay of the magnetic field, which could be accompanied by a sudden cooling of
the star or a gamma ray burst.
