Contains spoilers for the season five finale of Game of Thrones

When Game of Thrones has Cersei Lannister take a naked walk of penance after her imprisonment at the Sept—an act that actress Lena Headey has said is so humiliating that nobody would ever deserve it—part of the point is that she’s all alone. In a crowd of the clothed masses, she is naked. A ringing bell draws attention to her plight. She leaves a single trail of bloody footprints. But, despite all that, she’s not actually alone: Cersei is part of a long history of medieval “walk of shame” participants.

George R.R. Martin has cited one particular such walk as an inspiration for what happens to Cersei: Jane Shore, a mistress of King Edward IV of England, who did her penance in 1483. Edward had fallen and Richard III—against whose rise she had conspired—took the throne that year. Though Richard’s reasons for hating her were largely political, her punishments were tied to her harlotry. So, as would have been a common punishment for adultery, she was made to walk through the city in her undergarments, with bare feet.

But, though there’s an obvious link between Jane Shore and Cersei, the history goes back even deeper, according to Larissa Tracy, author of Torture and Brutality in Medieval Literature. “[Jane Shore] wasn’t naked,” Tracy points out. “The naked part is very specific to adultery.”

In particular, Tracy points to the customary laws of 13th- and 14th-century France, a time and place in which that kind of public shaming was a prominent punishment. Though conviction for adultery had tough standards—the couple had to be caught in the act—the naked walk of shame that followed such a conviction could pretty much ruin a person’s life. The punishment was often for the woman alone, Tracy adds, though in rarer cases the man involved could also have to do public penance as well. In some accounts, trumpets are used to herald the passing of the penitent, so that everyone in the town would come out to see. “The goal is to create a lasting stigma,” she explains. “In the middle ages, your legal standing was largely determined by your reputation and by your social standing in the community.”

Because of legal reliance on the concept of fama—Latin for fame, or reputation—a person’s status in the community could be permanently shaped by past sins. Only a person who was already of ill fame, for example, could be subjected to torture in order to force a confession. (Torture is another link between King’s Landing and Old France: starting in 1215, when the Church moved away from the concept of trial by ordeal, torture was often used in France to elicit the kind of confession that Cersei makes to the High Sparrow.)

“The whole point is that everybody would know,” Tracy says. “That would taint their reputation for the rest of their lives.”

Another historical-mythological parallel can be seen in the literature of Guinevere and Lancelot. Though many people with casual knowledge of Arthurian legend think of Guinevere and Lancelot as romantic heroes, Guinevere was already married to King Arthur when she fell for the knight. Throughout the many iterations of the legend her reputation varies, and though their love is sometimes chaste there are also versions from as early as the 12th century in which her adultery becomes a key part of her story. In a number of tellings, she’s accused of adultery and has to publicly atone for it. (And it’s not just the humiliation that ties Guinevere to Cersei: remember that the cousin with whom Cersei committed adultery, the affair for which the punishment is being inflicted, is named Lancel.) In some cases, she’s actually condemned to being burned at the stake, only to be rescued at the last minute. The reason for that even harsher punishment for Guinevere is one worth keeping in mind of Game of Thrones fans, as Tracy points out: “When the Queen commits adultery, it’s treason.”

Cersei has yet to stand trial. If it doesn’t go well, the city and the High Sparrow seem unlikely to overlook the fact that her incestuous affair with Lancel was also a treasonous act against the King—and, if that happens, she could be looking at a punishment that makes a walk of shame look like a walk in the park.

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 Lily Rothman at lily.rothman@time.com.