The recently discovered soft gamma-ray emission from the anomalous X-ray pulsar 1E 1841-045 has a luminosity Lγ∼1036 ergs/s. This luminosity exceeds the spin-down power by 3 orders of magnitude and must be fed by an alternative source of energy such as an ultrastrong magnetic field. A gradual release of energy in the stellar magnetosphere is expected if it is twisted and a strong electric current is induced on the closed field lines. We examine two mechanisms of gamma-ray emission associated with the gradual dissipation of this current. (1) A thin surface layer of the star is heated by the downward beam of current-carrying charges, which excite Langmuir turbulence in this layer. As a result, it can reach a temperature kBT∼100 keV and emit bremsstrahlung photons up to this characteristic energy. (2) The magnetosphere is also a source of soft gamma rays at a distance of ∼100 km from the star, where the electron cyclotron energy is in the kilo-electron volt range. A large electric field develops in this region in response to the outward drag force felt by the current-carrying electrons from the flux of kilo-electron volt photons leaving the star. A seed positron injected in this region undergoes runaway acceleration and upscatters X-ray photons above the threshold for pair creation. The created pairs emit a synchrotron spectrum consistent with the observed 20-100 keV emission. This spectrum is predicted to extend to higher energies and reach a peak at ∼1 MeV.