2.5D simulation of the process of the magnetic isolation of electrons and the acceleration of ions when injecting a high-current ion beam, compensated by an electron beam, into a magnetic cusp with an accelerating gap, followed by its re-compensation by another electron beam and transportation along the drift region with a longitudinal magnetic field, was carried out. The dependence of the characteristics of the accelerated and compensated ion beam at the drift region exit upon the set of initial parameters of the ion and electron beams and the values of the magnetic and accelerating electric fields was considered.