Devotees of the sort of material in which “Masterpiece Theatre” specializes–veddy British period pieces marked by classily sudsy stories, lush locations, close attention to visual detail, splendid cinematography and acting of high quality–will embrace Charles Dance’s adaptation of William J. Locke’s short story about a pair of elderly spinster sisters, the Widdingtons, who take in a young Polish man whom they find washed up on the shore near their seaside home and patiently nurse back to health. Though the story is situated in the late 1930s and there are occasional references to Germany’s breaches of her agreements and the threat of war, the picture doesn’t take the path one might expect from them, except in an incidental way (at one point characters who speak German are looked on with suspicion). Instead its theme is repressed passion. That’s made most clear in the possessive, or perhaps more properly proprietary, attitude that the younger, more flighty of the sisters, Ursula (Judi Dench), develops toward Andrea (Daniel Bruhl), their incapacitated guest. Ursula seems never to have enjoyed a close relationship with a man before, and her attraction to Andrea is so unexpected and incomprehensible, even to her it seems, that it even causes rifts in her lifelong understanding with her decidedly more practical, down-to-earth sister Janet (Maggie Smith), who does–it’s revealed later on–at least have the remembrance of love with a man who’d died in the First World War to comfort her. (Observing them both with a shrewd but affectionate eye is their housekeeper Dorcas, played with a jovial air of frumpishness by Miriam Margolyes.)

But Ursula’s interest in Andrea–which doesn’t actually go beyond preparing to stroke his hair as the boy sleeps, one must rush to say–isn’t the only instance of repressed desire on display here. The pain of unrequited passion is also found in Francis Mead (David Warner), the brusque village doctor the sisters call upon to treat Andrea. Mead is obsessed with Olga Danilof (Natascha McElhone), a worldly Russian painter who’s vacationing in a seaside cottage neighboring the Widdington homestead. She, however, finds his attention more amusing than serious, and keeps putting him off. Her interest instead gravitates toward Andrea, who–in what becomes the linchpin of an increasingly improbable plot–turns out to be a promising violinist whom she wants to introduce to her brother, who just happens to be a famous virtuoso (as well as composer and conductor) performing in London. A crisis occurs when Ursula and Janet keep word about Olga’s brother, and his possible interest in Andrea, from the young man to prevent him from leaving them.

From the standpoint of narrative, there’s a good deal that’s less than satisfying about “Ladies in Lavender.” Not the underlying “lonely passion” of Ursula Widdington, to use the phrase from the title of a Brian Moore novel that was made into a fine film starring none other than Maggie Smith back in 1987; that’s actually the most fascinating aspect of the picture, and it’s played with just the right mixture of longing and reticence by Dench. Nor the wonderful rapport Dench has with the steelier Smith, who puts her old-maidish sternness to perfect use here. Together the two provide a master thespian class, performing the same sort of verbal cinematic soft-shoe routine that, for example, James Mason and John Gielgud danced in “The Shooting Party,” though theirs was on a far smaller canvas. Margolyes is also a joy to watch, employing her compact frame to marvelously humorous effect as she bustles about in her common-sensical, intrusive way, and Bruhl provides a handsome presence as Andrea, even though as written the character is rather a cipher, a pawn shuttled about by the women in his life.

The real problem with the film lies in the narrative turns involving Olga. The business with Dr. Mead is bad enough–especially since Warner plays the driven physician without much subtlety (a scene in a pub is particularly strident). But when the violin subplot comes up, things deteriorate badly. The coincidences are substantial, but even if one is willing to swallow them, the way they’re played out–with Olga persuading Andrea to do something that makes him seem even more of a milksop (and an ungrateful one at that)–don’t really compute. Then, when the script takes a further detour to provide a “happy” ending, it does so in a fashion that’s neither sentimentally satisfying nor effectively biting–just a clumsy combination of the two (and, once again, necessitating an attitude on Andrea’s part that’s simply incredible).

So the question comes down to whether the strength of the lead performances and the beauty of the setting are enough to overcome the vagaries in the storytelling, and in this case they just barely do. “Ladies in Lavender” is not a great film, but the joy of watching Dench and Smith perform their charming duet for nearly two hours makes it worthwhile.