During the last years great attention has been given to the encapsulation of magnetic nanoparticles. In this work we investigated the stability of small magnetic particles inside magnetic nanotubes. Multisegmented geometries were tested in order to optimize the stability of the particle inside the nanotubes. Our results evidenced that multisegmented nanotubes are more efficient to entrap the particles at temperatures up to hundreds of kelvins. (C) 2011 American Institute of Physics. {[}doi:10.1063/1.3537806]