The control of 2/1 neoclassical tearing modes (NTMs) with electron cyclotron (EC) waves has been studied both experimentally and numerically on TCV. Dynamic evolutions of NTMs along with time-varying deposition locations of the control beam have been studied in detail. The prevention of NTMs by means of preemptive EC (i.e. the control beam is switched on before the mode onset) has also been explored. A small sinusoidal sweeping with full amplitude of 0.07 (normalized to the minor radius) has been added to the control beam in two of the experiments to facilitate the comparison between NTM stabilization and prevention. It is shown that the prevention of NTMs is more efficient than NTM stabilization in terms of the minimum EC power required. Interpretative simulations with the Modified Rutherford Equation (MRE) have been performed to better quantify various effects, with coefficients well defined by dedicated experiments. Specifically, in order to obtain more insight on the dominant dependencies, a simple ad-hoc analytical model has been proposed to evaluate the time-varying classical stability index ∆ in the test discharges, based on the ∆ -triggered nature of these 2/1 NTMs. This allows simulating well the entire island width evolution with the MRE, starting from zero width and including both NTM stabilization and prevention cases for the first time. The exploration of NTM physics and control has facilitated the development of an NTM controller that is independent of the particular features of TCV and has been included in a generic plasma control system (PCS) framework. Integrated control of 2/1 NTMs, plasma β (the ratio of plasma pressure to magnetic pressure) and model-estimated safety factor q profiles has been demonstrated on TCV.