Apparently the church got entangled into politics and the precepts of man:
"Our tour of the strange world of medieval justice starts with The Cadaver Synod of 897. Or, as many have come to call it, “The Dead Pope Trial.”
The mid to late 800s was a bad time for popes. Charlemagne’s empire had crumbled and Europe had split into smaller and smaller fiefdoms. Many of these fiefdoms eyed Rome’s treasury and sought protection money. Because of Rome’s weakened condition, popes in the late 800s depended on the support of secular leaders to hold office and to achieve goals. It was a time of political factions. A pope had to be aligned with the right faction to accomplish much of anything.
In this turbulent time, Bishop Formosus of Portus—Portus being a western suburb of Rome—was making a name for himself in Catholic circles. In the 860s, the Pope called on Formosus to manage important Church matters in Bulgaria, France, and Trent. Each time he received high marks for his work, so much so that people began mentioning Formosus as a candidate for pope when the next vacancy opened up.
But when an opening occurred in 872, the papacy went to a rival, Pope John VIII. And then when Formosus found himself on the wrong side of the issue of who should be crowned the new emperor, he fled Rome. Pope John VIII convened a synod and charged Formosus with a laundry list of crimes under Church law. Among the charges were deserting his diocese without permission, opposing the crowning of the emperor, and (quote) “conspiring with certain iniquitous men and women for the destruction of the papal see.” Formosus was convicted, defrocked, and excommunicated.
You might think that would be the end of Formosus’s papal ambitions, but you’d be wrong. Six years later, the excommunication was lifted. In return, Formosus promised never to return to Rome or execute priestly duties. And for a while, he didn’t.
But then, in 882, Pope John VIII was clobbered over the head with a hammer, thus becoming the first pope to be assassinated.
Newly installed Pope Marinus didn’t share his predecessor’s grudge with Formosus. So he released Formosus from his oath, and restored him to his old diocese.
Three more popes came and went—they seemed to drop dead with alarming regularity around this time—until at last, in 891, Formosus became the first former ex-communicant to be elected Pope.
But the job came with a host of thorny problems. The most important concerned the messy politics of the Church and the Holy Roman Empire. The previous pope had made a commitment to crown as Roman emperor the very young Guy Spoleto III. But Formosus had his own idea as to who should be emperor."
More at:
Medieval Trials, Great and Gruesome