While galaxies like our own Milky Way have a few hundred globular clusters, giant ellipticals like M87, at the center of the Virgo cluster of galaxies, may have ten or twenty thousand of them. One explanation for the origin of this huge retinue of globular clusters is that most of them are the nuclei of dwarf nucleated galaxies that once belonged to the Virgo cluster and were later on captured by M87, losing their outer regions in the process. We performed numerical simulations to check whether such a scenario is possible and found that, while nonnucleated dwarf galaxies disintegrate completely after a few passages close to the center of the giant galaxy, the nuclei of nucleated galaxies manage to survive. To get remnants similar to globular clusters, in -both luminosity and linear size, short pericentral distances are needed; remnants at least an order of magnitude larger result from distant passages. A search for such large remnants in the outskirts of M87 would be helpful to decide whether a significant number of globular clusters may have the proposed origin or not.