  We obtained self-similar solutions of relativistically expanding magnetic
loops taking into account the azimuthal magnetic fields. We neglect stellar
rotation and assume axisymmetry and a purely radial flow. As the magnetic loops
expand, the initial dipole magnetic field is stretched into the radial
direction. When the expansion speed approaches the light speed, the
displacement current reduces the toroidal current and modifies the distribution
of the plasma lifted up from the central star. Since these self-similar
solutions describe the free expansion of the magnetic loops, i.e., $Dv/Dt=0$,
the equations of motion are similar to those of the static relativistic
magnetohydrodynamics. This allows us to estimate the total energy stored in the
magnetic loops by applying the virial theorem. This energy is comparable to
that of the giant flares observed in magnetars.
