The Austrian Archduke Ferdinand Maximilian (1832 - 1867) was installed in Mexico as a puppet emperor by Napoleon III in 1863. He was dependent on the support of the occupying French army and when Napoleon withdrew his troops Maximilian was captured by Mexican forces loyal to their legitimate republican government. He was executed alongside two of his generals, Mejía and Miramón, on 19 June 1867.
The left-hand section of the canvas showing General Mejía was probably cut off by Manet himself. After the artist's death the canvas was cut up into smaller fragments, some of which were sold separately. Edgar Degas eventually purchased all the surviving fragments and reassembled them on a single canvas. A sketch for a group of soldiers, formerly in the Gallery and now in the British Museum, was once thought to have been made in preparation for this work, but its attribution to Manet is no longer certain.