A kinetic equation is derived for fast electrons in toroidal, tokamak- or stellarator-type magnetic devices. It is of a different type for different groups of electrons, i.e. passing or trapped electrons, in a magnetic field. The solution of the kinetic equation is found, and analytic expressions for the electron distribution function are obtained for the case of an ideal (non-rippled) torus and an electric field weaker than the critical Dreicer field. The runaway flux of electrons is found. The case of a rippled torus is investigated by taking account of the vertical drift resulting in electrons blocked in the ripples being lost to the chamber walls. Considerable plasma loss is shown to be possible only for electrons of an energy exceeding some quantity
d, which depends on the magnetic field, the depth of the ripple, the plasma density, and the parameters of the device.