Jean-Paul Laurens’s “Pope Formosus and Stephen VII”, 1870.
This painting depicts the so-called Cadaver Synod of 897, one of the most bizarre incidents in the history of the papacy. During this incident, the reigning pope, Stephen VI (who is sometimes regarded as Stephen VII for unrelated reasons) had the corpse of his predecessor, the late Pope Formosus, removed from its tomb and put on trial for various crimes including perjury, practicing as a bishop while a layman, and attempting to usurp the papacy from a previous pope, John VIII. Whether this is true or not, John VIII seems to have believed Formosus had this intention, and excommunicated him in 876, though this was reversed after John VIII’s death in 882 (following which, Formosus became pope himself in 891 until his death in 896).
At the Cadaver Synod, the corpse of Formosus was found guilty, stripped of its vestments, buried in a graveyard for foreigners, dug up, and finally thrown into the Tiber River. Rumors soon circulated that the corpse, which washed up on the shores of the river, had begun performing miracles. The hideousness of the Cadaver Synod led to riots against Stephen, who was arrested and then strangled in prison. Stephen’s successor, Pope Theodore II, annulled the findings of the synod and had Formosus’s body reburied in papal vestments before dying at the end of that year. His successor, John IX, confirmed Formosus’s rehabilitation. Then, early in the 10th century, another pope, Sergius III (the only pope in history to have fathered an illegitimate child who later became pope as well) overturned the rulings of Theodore II and John IX, and had the body of Formosus dug up again and beheaded. It should be noted that Sergius may have been motivated by less than pure motives, having been a judge at the Cadaver Synod under Stephen.
All of this makes (slightly) more sense in the context of the times. During this period in history, the papacy saw a rapid succession of popes who were appointed and deposed often at the whim of competing political factions in Rome. It was in the interests of a new pope to discredit previous popes who were aligned with another faction.