Density functional theory calculations were used to investigate the stability of single-walled carbon nanotubes (CNTs) attached to nanoparticles. The total energies and the adhesion energies between the CNTs and the nanoparticles were calculated for systems where the nanoparticles were either pure Ni or Ni carbide. It was found that the adhesion between the CNT and a pure Ni cluster is stronger than between the same CNT and a Ni carbide cluster although the energy difference was small compared to the total adhesion energies. This adhesion strength implies that CNTs are likely to remain attached to both pure Ni and Ni carbide clusters and that either pure Ni or Ni carbide clusters may be docked onto the open CNT ends to achieve continued growth or electronic contacts between CNTs and electrode materials. The system with a CNT attached to a pure Ni cluster was found to be energetically favored compared to a system containing the same CNT attached to a Ni carbide. The difference in total energy implies that a CNT should act as a sink for C atoms dissolved in the Ni carbide cluster, which means that the dissolved C atoms will be drained from the cluster, yielding a pure metal in the zero Kelvin thermodynamic limit. It is argued that this draining procedure is likely to occur even if carbon is added to the cluster at a proper rate, for example, during CNT growth.