Magnetic reconnection as a mechanism for the generation of fast electrons