Topological protection precludes a continuous deformation between topologically inequivalent configurations in a continuum. Motivated by this concept, magnetic skyrmions, topologically nontrivial spin textures, are expected to exhibit topological stability, thereby offering a prospect as a nanometer-scale nonvolatile information carrier. In real materials, however, atomic spins are configured as not continuous but discrete distributions, which raises a fundamental question if the topological stability is indeed preserved for real magnetic skyrmions. Answering this question necessitates a direct comparison between topologically nontrivial and trivial spin textures, but the direct comparison in one sample under the same magnetic fields has been challenging. Here we report how to selectively achieve either a skyrmion state or a topologically trivial bubble state in a single specimen and thereby experimentally show how robust the skyrmion structure is in comparison with the bubbles. We demonstrate that topologically nontrivial magnetic skyrmions show longer lifetimes than trivial bubble structures, evidencing the topological stability in a real discrete system. Our work corroborates the physical importance of the topology in the magnetic materials, which has hitherto been suggested by mathematical arguments, providing an important step toward ever-dense and more-stable magnetic devices.