  Magnetar flares generate Alfv\'en waves bouncing in the closed magnetosphere
with energy up to $\sim 10^{46}$ erg. We show that on a 10-ms timescale the
waves are transmitted into the star and form a compressed packet of high energy
density. This packet strongly shears the stellar crust and initiates a plastic
flow, heating the crust and melting it hundreds of meters below the surface. A
fraction of the deposited plastic heat is eventually conducted to the stellar
surface, contributing to the surface afterglow months to years after the flare.
A large fraction of heat is lost to neutrino emission or conducted into the
core of the neutron star.
