The painting above is a depiction of the infamous Cadaver Synod, when a mad pope tried a dead one. Here's the gruesome story as told by Donald E. Wilkes, via Exploding Aardvark and Metafilter:

The Cadaver Synod occurred sometime in January 897 in the Church of St. John Lateran, the pope's official church in his capacity as Bishop of Rome. The defendant on trial was Formosus, an elderly pope who after a reign of five years had died April 4, 896 and been buried in St. Peter's Basilica. (According to P. G. Maxwell-Stuart's Chronicle of the Popes (1997), the name Formosus means "good-looking" in Latin.) The trial of Formosus was ordered by the reigning pontiff, Stephen VII,

who had been prodded into issuing the order by a powerful Roman family dynasty and other anti-Formosus political factions, and who apparently

also was personally motivated by what The Oxford Dictionary of Popes (1986) calls a "near-hysterical hatred [of Formosus]." Although Formosus had been, according to McBrien, "a man of exceptional intelligence, ability, and even sanctity, he [had] made some bitter political enemies ... including one of his successors, Stephen VII."

No trial transcript of the Cadaver Synod exists. Nonetheless, it is reasonably clear what happened. Sitting on a throne, Stephen VII personally presided over the proceeding. Also present as co-judges were a number of Roman clergy who were there under compulsion and out of fear. The trial began when the disinterred corpse of Formosus was carried into the courtroom. On Stephen VII's orders the putrescent

corpse, which had been lying in its tomb for seven months, had been dressed in full pontifical vestments. The dead body was then propped up in a chair behind which stood a teenage deacon, quaking with fear, whose unenviable responsibility was to defend Formosus by speaking in his behalf. The presiding judge, Stephen VII, then read the three charges. Formosus was accused of (1) perjury, (2) coveting the papacy, and (3) violating church canons when he was elected pope.

The trial was completely dominated by Stephen VII, who overawed the assemblage with his frenzied tirades. While the frightened

clergy silently watched in horror, Stephen VII screamed and raved, hurling insults at and mocking the rotting corpse. Occasionally, when the

furious torrent of execrations and maledictions would die down momentarily, the deacon would stammer out a few words weakly denying the charges.

When the grotesque farce concluded, Formosus was convicted on all counts by the court. The sentence imposed by Stephen VII was that all Formosus's acts and ordinations as pope be invalidated, that the three fingers of Formosus's right hand used to give papal blessings be hacked off, and that the body be stripped of its papal vestments, clad in the cheap garments of a lay person, and buried in a common grave. The sentence was rigorously executed. (The body was shortly exhumed and thrown into the Tiber, but a monk pulled it out of the river.)

Stephen VII's fanatical hatred of Formosus, his eerie decision to convene the Cadaver Synod in the first place, his even eerier decision to have Formosus' corpse brought into court, his maniacal conduct during the grisly proceeding, and his barbaric sentence that the corpse be abused and humiliated make it difficult to disagree with the historians who say that Stephen VII was stark, raving mad.