From its ritualized opening scene, “The Last Duel” bears all the contours of a hoary medieval spectacle, the kind of crunchy-gravel and clanging-chain mail fantasy that harks to a lamentably bygone age of courtly love and chivalric virtue.

But all is not as it seems in this sly study of systemic patriarchy and narrative revisionism. Like most good yarns, “The Last Duel” begins at the ending — in 1386, when a French knight named Jean de Carrouges (Matt Damon) confronts onetime friend Jacques Le Gris (Adam Driver). De Carrouges’s wife, Marguerite (Jodie Comer), has accused Le Gris of rape; to preserve his good name and — purely an afterthought — justice for his wife, de Carrouges has challenged Le Gris to a fight to the death: Whoever survives will by definition be in the right, with God on his side. (“The Last Duel” is based on Eric Jager’s book about the episode, and tacks closely to real-life events.)

Flash back several years earlier, when de Carrouges and Le Gris are allies fighting on behalf of King Charles VI (played with fey indifference by Alex Lawther). “The Last Duel” is structured in three chapters, the first telling “the truth according to Jean de Carrouges,” the second hewing to Le Gris’s version of events and the third relating Marguerite’s story. What ensues is an intriguing exercise in unreliable storytelling and justification, as the men puff their stories up with hyperbole and self-flattering glory. By the time the film finally focuses on Marguerite, she feels like an afterthought amid a welter of warring egos, performative male aggression and swordplay both literal and metaphoric.

Written by Damon and Ben Affleck — who portrays a manipulative, morally degenerate Count Pierre d’Alençon, under whom de Carrouges serves as a vassal — “The Last Duel” is clearly designed to speak to our present moment: Nicole Holofcener collaborated on the script, and her wry, observant humor courses through the film, as do acerbic nods toward the pride and protection, property rights and power plays that underlie ideas of purity and sexual rectitude. (“There is no ‘right,’ ” Marguerite’s mother-in-law, played by the fabulous Harriet Walter, insists at one point. “There is only the power of men.”) Director Ridley Scott evinces his prodigious gifts for setting a scene and purveying rich production values: “The Last Duel” looks sensational, with no detail spared for either the fetishistically layered costumes of the era (that chain mail!) or the graphic grotesquerie of battle (that spurting blood!). At its core, though, “The Last Duel” is less about the 14th century than our own, and how issues like consent, control and hierarchies of credulity haven’t evolved as much as morphed to fit new mores.

It’s a provocative idea, and for most of its running time “The Last Duel” keeps it aloft by means of compelling characters and a sneakily shifting story. Despite haircuts that evoke a “Monty Python and the Holy Grail” outtake, Damon and Affleck acquit themselves well in roles that could be generously described as counterintuitive. Between his regrettable mullet and tufty chin-beard in “The Last Duel” and his Everyman dad-bod in “Stillwater,” Damon might deserve an award for least vain actor of 2021. Driver is allowed to look more conventionally handsome, even if his character is slippier: Once the rhythms of the piece take over, he makes Le Gris his own, keeping friends, enemies and audiences guessing as to his own buried ambitions.

The filmmakers cannily reward viewers who come to “The Last Duel” for pomp and pageantry: It’s here, albeit presented within the frame of masculinity at is most toxically overcompensating. In fact, all the bro-code acting out would be ludicrous if it wasn’t so murderous. Part of the deal is that if Jean de Carrouges dies, Marguerite must be burned alive for having lied about her assault. As a portrayal of preening male vanity and misogynistic hypocrisy that exists to this day, “The Last Duel” reaches at relevancy with admirable ambition.

Jodie Comer, Adam Driver, Matt Damon and Ben Affleck star in "The Last Duel," a tale of betrayal and vengeance set in 14th-century France. (20th Century Studios)

But its baggy structure and long-winded running time wind up fighting its core principle. By the time it circles back to the titular confrontation — the ultimate cancellation — we still haven’t truly known Marguerite or heard her full story (although we’ve seen her assault gratuitously staged at least twice). Comer, who embodied one of TV’s great antiheroines as Villanelle in “Killing Eve,” here seems uncharacteristically meek and voiceless, forced to communicate by way of meaningful glances through tear-welled eyes. “The Last Duel” is an entertaining movie, even an intriguing one. But audiences might be forgiven for thinking, upon leaving the theater, that they’ve just been very nobly and very honorably mansplained.

The Last Duel (153 minutes, at area theaters) is rated R for strong violence including sexual assault, sexual content, some graphic nudity and coarse language.