A general theory is developed for self-consistent calculations of mode competition in a gyrotron with nonfixed axial structure of the RF field for arbitrary cyclotron harmonics. The theory is applied to the gyrotron operating at the Kernforschungszentrum Karlsruhe with a frequency of 150 GHz. The formalism presented allows a self-consistent calculation of mode competition for the operating and parasitic modes at the cyclotron resonance at arbitrary harmonics. Specific calculations are carried out for the cases n/sub 0/=1, n/sub 1/=2 and n/sub 0/=2, n/sub 1/=1. It is emphasized that the formalism considered applies only to the case in which the azimuthal orthogonality condition is satisfied: n/sub 0/m/sub 1/ not=n/sub 1/m/sub 0/. There are circumstances when this condition is not satisfied.< <ETX xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">></ETX>