Hollywood’s latest take on the Vatican, The Young Pope, imagines a power-drunk man in one of the world’s most intriguing seats. Jude Law, 44, plays a totally fictional, totally devious cardinal who gets elected as Pius XIII in the new Paolo Sorrentino series premiering Sunday on HBO.

The show focuses plenty of attention on how young this Pope is, but by most accounts, Pope John XII, who held the position in the late 10th century, was the real youngest Pope in history—a mere teenager when he gained the position, though accounts differ on his exact age. And however scheming the show’s Pope gets, Pope John XII’s track record is tough to beat.

“There have been unsavory Popes, but he was certainly the one with the worst reputation,” Ken Pennington, a professor at the Catholic University of America, tells TIME.

He was charged with disloyalty and adultery, and historians maintain that even though his reign dates back to an age when historical records are questionable, both charges are true. His papacy even started with a broken rule, though it’s one for which he can’t be blamed: When his powerful father Duke Alberic II of Spoleto told the clergy to appoint his illegitimate son as Pope, he violated the decree that papal replacement plans aren’t supposed to begin before a sitting Pope dies. The clergy honored the duke anyway, and made his son the Pope.

Pope John XII also served as prince of Rome, like other pontiff figures of the era, so he wasn’t the first Pope who split his duties between secular and sacred. But evidence shows that his primary goal was to protect the papal states, rather than inspire believers. He faced a deeply fractured region, with many tangled political conflicts, so that was a difficult task.

Case in point: John XII kicked his papacy off with a bang, leading an army against two Italian duchies to try to reclaim key papal states. He was unsuccessful, and he needed military aid. “It was a complete disaster,” says Thomas Noble, a history professor at the University of Notre Dame.

Get your history fix in one place: sign up for the weekly TIME History newsletter

His biggest moment came—possibly out of desperation-borne savvy—when in 962 he crowned the German King Otto I as Holy Roman Emperor. Under the Diploma Ottonianum, the Pope offered Otto the imperial title he craved, and in exchange, Otto defended the papal states against an Italian King, Berengar II, who was invading the papal states. By crowning Otto to get his army’s protection, John XII restored the Holy Roman Empire. Popes after John XII continued to crown emperors until 1530.

“He was not the most admirable Pope,” says Pennington. “In fact, he was probably one of the worst popes that ever lived, but he was not a dummy.”

But the alliance with Otto didn’t last a year. Pope John XII soon aligned with Berengar II’s son behind Otto’s back. (Historians speculate that this was because he regretted granting Otto so much power.) “Otto quickly concluded John was unreliable, immoral and a bit of a crook,” Noble says. Infuriated, Otto briefly deposed Pope John XII. But by regaining the trust of church members and getting rid of his enemies, John was soon able to resume the papacy.

Pope John XII also caused a fair amount of scandal with his private life. Though some allegations of the young Pope’s doings are likely exaggerated—Otto’s ally Liudprand of Cremona wrote in History of Otto that Pope John XII turned the palace into a “brothel”—the charge that he was not celibate holds up to historical scrutiny. “He was a randy Pope,” Pennington says. “It was pretty unanimous that he was a dissolute Pope who had many women in the Lateran.”

Toward the end of his life, the young Pope wanted to reconcile with Otto, according to Kevin Madigan, Winn Professor of Ecclesiastical History at Harvard University. But before he could, he died in his mid-20s in Naples, in May of 964. According to legend, he had a stroke while he was in bed with a married woman.

“It is almost impossible to be a good prince and Pope at the same time,” says Madigan, who points out that not everything from John XII’s reign was scandalous. He championed religious causes, for example with his support of Saint Dunstan, a leader of England’s monastic reform movement. “His genuine interest in church reform has often been overlooked and his impieties and scandals exaggerated because of the way he was portrayed by his enemies, who were partisans of King Otto.”

And his influence still endures in at least one religious realm: Popes’ names. Though John was an incredibly popular name, belonging to 11 of his predecessors, he took it up as his apostolic name only after being selected to lead the Church. He thus earned the distinction of being one of the first Popes to change his name upon assuming the job.

Popes of all ages have followed suit all the way up until today.

Get our History Newsletter. Put today's news in context and see highlights from the archives. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Write to Ashley Hoffman at Ashley.Hoffman@time.com.