Tokamak disruptions are events of fatal collapse of the magnetohydrodynamic (MHD) confinement configuration, which cause a rapid loss of the plasma thermal energy and the impulsive release of magnetic energy and heat on the tokamak first wall components. The physics of the disruptions is very complex and non-linear, strictly associated with the dynamics of magnetic tearing perturbations. The crucial problem of the response to the effects of localized heat deposition and current driven by external (rf) sources to avoid or quench the MHD tearing instabilities has been investigated both experimentally and theoretically on the ASDEX Upgrade tokamak. The analysis of the conditions under which a disruption can be prevented by injection of electron cyclotron (EC) rf power, or, alternatively, may be caused by it, shows that the local EC heating can be more significant than EC current drive in ensuring neoclassical tearing modes (NTMs) stability, due to two main reasons: first, the drop of temperature associated with the island thermal short circuit tends to reduce the neoclassical character of the instability and to limit the EC current drive generation; second, the different effects on the mode evolution of both the location of the power deposition relative to the island separatrix and the island shape deformation lead to less strict requirements of precise power deposition focussing. A contribution to the validation of theoretical models of the events associated with NTM is given and can be used to develop concepts for their control, relevant also for ITER-like scenarios. [http://dx.doi.org/10.1063/1.4752423]