  The stability of sunspots is one of the long-standing unsolved puzzles in the
field of solar magnetism. We study the effects that destabilise and stabilise
the flux tube of a simulated sunspot in the upper convection zone. The
depth-varying effects of fluting instability, buoyancy forces, and timescales
on the flux tube are analysed. The simulation was calculated with the MURaM
code. The domain has a lateral extension of 98 Mm x 98 Mm and extends almost 18
Mm below the solar surface. The analysed data set of 30 hours shows a stable
sunspot at the solar surface. We studied the evolution of the flux tube at
horizontal layers by means of the relative change in perimeter and area with a
linear stability analysis. We find a corrugation along the perimeter of the
flux tube that proceeds fastest at a depth of about 8 Mm below the surface.
Towards the surface and towards deeper layers, the decrease in compactness is
damped. From the stability analysis, we find that above a depth of 2 Mm, the
sunspot is stabilised by buoyancy forces. The spot is least stable at a depth
of about 3 Mm because of fluting instability. The stability of the sunspot at
the surface affects the behaviour of the field lines in deeper layers by
magnetic tension. Therefore the fluting instability is damped at depths of
about 3 Mm, and the decrease in compactness is strongest at a depth of about 8
Mm. The more vertical orientation of the magnetic field and the longer
convective timescale slow down the corrugation process in layers deeper than 10
Mm. The formation of large intrusions of field-free plasma below the surface
destabilises the sunspot, and eventually lead to the disruption and decay of
the sunspot. This process is not visible at the surface, where the sunspot is
stabilised by buoyancy forces. The onset of sunspot decay occurs in deeper
layers, while the sunspot still appears stable in the photosphere.
