We study the collapse of an axisymmetric liquid filament both analytically and by means of a numerical model. The liquid filament, also known as ligament, may either collapse stably into a single droplet or break up into multiple droplets. The dynamics of the filament are governed by the viscosity and the aspect ratio, and the initial perturbations of its surface. We find that the instability of long viscous filaments can be completely explained by the Rayleigh-Plateau instability, whereas a low viscous filament can also break up due to end pinching. We analytically derive the transition between stable collapse and breakup in the Ohnesorge number versus aspect ratio phase space. Our result is confirmed by numerical simulations based on the slender jet approximation and explains recent experimental findings by Castréjon-Pita et al.