  The first self-consistent simulations of electron acceleration during
magnetic reconnection in a macroscale system are presented. Consistent with
solar flare observations the spectra of energetic electrons take the form of
power-laws that extend more than two decades in energy. The drive mechanism for
these nonthermal electrons is Fermi reflection in growing and merging magnetic
flux ropes. A strong guide field is found to suppress the production of
nonthermal electrons by weakening the Fermi drive mechanism. For a weak guide
field the total energy content of nonthermal electrons dominates that of the
hot thermal electrons even though their number density remains small. Our
results are benchmarked with the hard x-ray, radio and extreme ultra-violet
(EUV) observations of the X8.2-class solar flare on September 10, 2017.

Plasma Physics;High Energy Astrophysical Phenomena