A numerical simulation method is used to show the possibility of forming a current sheet in the solar corona in an active region with four magnetic poles. The evolution of the quasi-stationary current sheet can lead to its transfer to an unsteady state. The MHD instability of this sheet causes its decay, accompanied by a set of events which characterizes the solar flare. The electrodynamical model of a solar flare includes a system of field-aligned currents typical of a magnetospheric substorm. Several events in substorms and solar flares are explained by the generation of field-aligned currents.