The episode depicted here is described by Jacobus de Voragine in his Legenda aurea (1275). When the leg of Pope Felix became cancerous, the martyrs Cosmas and Damian cut it off and replaced it with that of an Ethiopian buried on the same day.
An angel instructs them that, on the day of the resurrection, they must orchestrate a swap. When the sick man awoke “he saw nothing in the leg”, believing “that he was not himself, but another”. In Spanish iconography, the mutilated Ethiopian often appears in the scene, alive and in agonising pain.