  We study the coupling of the force-free magnetosphere to the long-term
internal evolution of a magnetar. We allow the relation between the poloidal
and toroidal stream functions - that characterizes the magnetosphere - to
evolve freely without constraining its particular form. We find that, on
time-scales of the order of kyr, the energy stored in the magnetosphere
gradually increases, as the toroidal region grows and the field lines expand
outwards. This continues until a critical point is reached beyond which
force-free solutions for the magnetosphere can no longer be constructed, likely
leading to some large-scale magnetospheric reorganization. The energy budget
available for such events can be as high as several $10^{45}\,$erg for fields
of $10^{14}\,$G. Subsequently, starting from the new initial conditions, the
evolution proceeds in a similar manner. The time-scale to reach the critical
point scales inversely with the magnetic field amplitude. Allowing currents to
pass through the last few meters below the surface, where the magnetic
diffusivity is orders of magnitude larger than in the crust, should give rise
to a considerable amount of energy deposition through Joule heating. We
estimate that the effective surface temperature could increase locally from
$\sim 0.1\,$keV to $\sim 0.3 - 0.6\,$keV, in good agreement with observations.
Similarly, the power input from the interior into the magnetosphere could be as
high as $10^{35} - 10^{36}\,$erg/s, which is consistent with peak luminosities
observed during magnetar outbursts. Therefore, a detailed treatment of currents
flowing through the envelope may be needed to explain the thermal properties of
magnetars.
