  We show that magnetic fields stronger than about $10^{15}$ G are able to
suppress the development of the hydrodynamical bar-mode instability in
relativistic stars. The suppression is due to a change in the rest-mass density
and angular velocity profiles due to the formation and to the linear growth of
a toroidal component that rapidly overcomes the original poloidal one, leading
to an amplification of the total magnetic energy. The study is carried out
performing three-dimensional ideal-magnetohydrodynamics simulations in full
general relativity, superimposing to the initial (matter) equilibrium
configurations a purely poloidal magnetic field in the range $10^{14}-10^{16}$
G. When the seed field is a few parts in $10^{15}$ G or above, all the evolved
models show the formation of a low-density envelope surrounding the star. For
much weaker fields, no effect on the matter evolution is observed, while
magnetic fields which are just below the suppression threshold are observed to
slow down the growth-rate of the instability.
