It happens every November, along with the constancy of desire to make a better cranberry sauce: I get costume drama cravings. I’ve yet to see either of this year’s mainstream offerings—Joe Wright’s Anna Karenina and Tom Hooper’s aggressively star-studded Les Miserables—so I can’t speak to how they’ll fulfill those cravings. But Denmark’s A Royal Affair, opening this week in limited release, is a slam dunk in the genre, satisfying every period piece craving: torrid affair, mad king, bastard child, throngs at the palace gates and a history lesson that will be fresh to many.

Director Nikolaj Arcel introduces the teenaged English princess Caroline Mathilde (Alicia Vikander, who, coincidentally, plays Kitty in Anna Karenina) standing in a field of flowers, none of which can hold a candle to her beauty. It’s 1766 and the girl is due to be shipped off to wed her cousin, the king of Denmark and Norway, Christian VII (Mikkel Boe Folsgaard), When she’s told Christian is interested in art and literature and sometimes even likes to act in the theater, Caroline claps her girlish hands together and sighs, “I could not imagine a more perfect husband.”

Poor sweet Caroline. As her carriage pulls up at the European crossroads where royalty does the world’s fastest speed dating, Christian pops out from behind a tree like giddy pervert, giggling a staccato “hee hee hee.” He has the little pointed teeth of a cat and loves to bare his fangs and hiss. He’s half madman, half court jester, prone to inappropriate outbursts, sulking and thoroughly uninterested in marriage, or for that matter, in ruling Denmark. (His cabinet runs the country while Christian slumps in a chair like a teenager.) As he explains to his new personal physician, Johann Friedrich Struensee (Mads Mikkelsen, a sternly sexy, youthful version of Ciarán Hinds), his interests include big-breasted prostitutes and drinking, but definitely not Caroline, a budding intellectual who tries valiantly to make the marriage work but can’t ignore Christian’s flagrantly loutish behavior. “I want a fun queen,” he whines to Struensee.

If this were a silent film, the good doctor would twirl his moustache and the title card would read “That can be arranged!” A German and secret admirer of Voltaire, Struensee came to the palace with an agenda; he’s been dispatched by other believers in the Enlightenment to get the king’s ear. And he does; Christian has the biggest man crush of all time on the German. His mental illness is by no means cured by Struensee, but he’s healthier and even begins to make half hearted attempts to affect policy. But in addition to the king’s ear, the doctor captures the lonely queen’s heart, wooing her with loans of volumes of Rousseau and Voltaire. It’s an insane affair—how can you get away with anything when a grim-faced maid is smelling the royal sheets every morning?—and a lot of fun to watch, primarily because we want to see Caroline bloom. She’s learned and compassionate and Vikander, a honeyed beauty, imbues the character with fierce intelligence and backbone.

The movie takes an unexpected direction after the affair begins. When they’re not tearing off each other’s sack-like undergarments, Struensee and Caroline begin to take over the government. They need Christian as a puppet, and take advantage of his desire to be an actor. Being a proper king is just a role, they tell him, feeding him lines as he rebels against his advisors. It’s all good stuff, small pox vaccinations for the poor, tripling the garbage collection in Copenhagen, no longer allowing the rich to run roughshod over the peasants. But the dynamic isn’t as purely nefarious as it sounds, every one blossoms. Christian even seems happy—although he could care less about the fan letter he receives from Voltaire, which he waves off as “blah blah blah”—and his mental illness remains in check. Struensee isn’t out to stab the king in the back; on some level, he genuinely cares about him. His outlook is very modern: “Who is the most disturbed, the king or someone who believes the world was made in six days?” he asks a fussy politician, and the movie manages to feel contemporary without ever leaving the 18th century.

For a year or so, Denmark is run as a royal democracy and the people are grateful. And miraculously, the unpleasant lunatic becomes a sympathetic, touching character. Folsgaard does wonders here, delivering a performance that’s very much like Tom Hulce’s in Amadeus; he makes the buffoon riveting. Watching it all far apart, as it must when people, even well intentioned people, become giddy with power, it’s particularly affecting to see the dissolution of the warm relationship between king, queen and the man they both loved. Because this story revolves, with a high degree of accuracy, around historical events not generally on the American curriculum, A Royal Affair enthralls where many historical dramas start to sag. We always know how it’s going to turn out for Queen Elizabeth I or Henry VIII’s wives, but Caroline Mathilde of Denmark and her illicit lover? Not so much. The somber epilogue, in which the queen’s children receive a letter from her, explaining everything, is poignant and elegantly told. Anyone eagerly awaiting Anna Karenina and Les Miserables shouldn’t miss A Royal Affair. New versions of old classics are a fine thing, but nothing beats a well told tale of a scandals past that you’ve never heard before.

Mary Pols has been reviewing film and occasionally books for TIME since 2009. She has degrees from Duke University, where she studied art history, and the University of California Berkeley’s School of Journalism. She is the author of a memoir about untraditional parenthood. It was made into a short-lived television comedy where everything turned out traditionally.

Accidentally on Purpose: The True Tale of a Happy Single Mother is available for nearly nothing at various online bookstores and from boxes in Pols' barn.