The plasma stability and confinement have been investigated through control ofthe safety factor profile q(r) by the electron cyclotron current drive inthe T-10 tokamak. The regimes with dq/dr≅0 and dq/dr<0in the plasma core were obtained. Various types of MHD activity were observed:ordinary sawtooth, saturated sawtooth, humpbacks, hills etc. It was shown thatwhen the minimal value qmin increases from qmin <1 to qmin = 2the plasma becomes strongly unstable due to the corresponding MHD activity orpasses to the steady-state improved confinement mode. The latter is realizedwhen the electron internal transport barrier (EITB) is formed. The conditionfor the appearance of the EITB is dq/dr≅0, where q = m/n lies neara rational value for low m and n.