We investigate theoretically indirect exchange interaction between magnetic impurities mediated by one-dimensional gapped helical states. Such states, containing massive Dirac fermions, may be realized on the edge of a two-dimensional topological insulator when time-reversal symmetry is weakly broken. We find that the indirect exchange interaction consists of Heisenberg, Dzyaloshinsky–Moriya, in-plane and out-of-plane Ising terms. These terms decay exponentially when the Fermi level lies inside the bandgap whereas the Dzyaloshinsky–Moriya term has smallest amplitude. Outside the bandgap, the massive helical states modify oscillatory behaviors of the range functions so that the period of oscillations decreases near the edge of band in terms of energy gap or Fermi energy. In addition, the out-of-plane Ising term vanishes in the case of zero-gap structure. Also, the oscillation amplitude of out-of-plane Ising term increases versus energy gap but it decreases as a function of Fermi energy. While the oscillation amplitudes of other components remain constant as functions of energy gap and Fermi energy. Analytical results are also obtained for subgap and over gap regimes. Furthermore, the effects of electron–electron interactions are analyzed.