After hitting a couple of commercial highs (“Dreamgirls,” “The Twilight Saga: Breaking Dawn”) and one major artistic low (“The Fifth Estate”) in the major-studio trade, Bill Condon makes a welcome return to more intimate, character-based fare in “Mr. Holmes,” an elegiac portrait of the once-great detective as a senescent old man — arthritic of body and foggy of mind, yet unwilling to go gently into that good night. A graceful film that seems happy to proceed at roughly the pace of the honey that drips from its central character’s apiary, this faithful adaptation of Mitch Cullin’s 2005 novel “A Slight Trick of the Mind” may disappoint audiences seeking a ripping good Sherlock Holmes mystery, but should delight genre buffs fond of such earlier revisionist Holmes yarns as “The Seven-Per-Cent Solution” and “Young Sherlock Holmes,” and even attract some younger viewers curious to see the old guy from “Lord of the Rings” and “X-Men” (aka Ian McKellen) slip into the skin of the world’s most famous sleuth. The newly rehabilitated Miramax should see profitable arthouse returns from its planned 2015 release in partnership with Lionsgate subsidiary Roadside Attractions.

If Condon seems like particularly good casting here, it’s because, in its theme of faded celebrity, and its central dynamic of an eminence grise, a young protege and a stern housekeeper, “Mr. Holmes” carries more than a faint echo of “Gods and Monsters,” the director’s 1998 Oscar winner about the last days of “Frankenstein” director James Whale (also played by McKellen). And while “Mr. Holmes,” which was adapted by screenwriter Jeffrey Hatcher, is ultimately a softer, sunnier film, it shares with its predecessor an acute sense of a dying man struggling to delineate fact from fantasy as he writes the final chapter of his life.

The Holmes we meet early on in “Mr. Holmes” is very much a fallen idol, aged 93 and long living in relative anonymity in a Sussex farm house, far from the prying eyes of the fans who once crowded the entrance to his Baker Street home, spurred on by the fictionalized Holmes tales published by his erstwhile partner, Dr. John Watson. The year is 1947, and Holmes whiles away his days tending to his bees and indulging another hobby, botany, under the watchful eye of his widowed cook, Mrs. Munro (Laura Linney), and her 14-year-old son, Roger (Milo Parker), who grooms himself in Holmes’ image. But as might be expected, Holmes’ hobbies are no mere passing fancies, but rather attempts at jogging his weary mind. Already showing the signs of short-term memory loss (call this “Still Sherlock” if you must), Holmes has taken to herbal remedies like royal jelly (hence the bees) and the more exotic prickly ash — an item rare enough to have occasioned a recent trip to Japan, where Holmes plucked it from the still-smoldering hillsides of Hiroshima.

Holmes longs to recover one memory in particular, that of the final case he worked on as a detective some 30 years earlier — a case involving an aggrieved husband, Thomas Kelmot (Patrick Kennedy); his depressive, childless wife (Hattie Morahan); and a strange musical instrument, a glass armonica, with possible occult powers. Above all, it was a case in which Holmes got something wrong — wrong enough to hang up his magnifying glass for good. If only he could remember what the hell it was. Now it is Holmes who is setting pen to paper in an effort to set the record straight, about his exploits in general and the glass armonica in particular, and to give himself peace of mind while he still has mind to appease.

While the good detective himself hobbles about with a cane, “Mr. Holmes” the movie glides smoothly back and forth across decades and continents as it follows these disparate plot strands through to their eminently logical conclusions. In Japan, Holmes is guided on his journey by the cheerful Mr. Umezaki (Hiroyuki Sanada), who claims to be a fellow herbalist but harbors his own ulterior motives that only gradually come to light. In the London of the past, Holmes tails the mysterious Mrs. Kelmot in an attempt to uncover her secrets. And in the Sussex of the present, busily writing away in his attic study, he struggles with each successive sentence to recall what exactly happened next. As in Cullin’s book (where “The Glass Armonicist” became a full-fledged novella-within-the-novel, complete with its own title page and chapter headings), the nesting of stories within stories creates a nifty hall-of-mirrors effect, climaxing in Holmes’ visit to a cinema screening a film adaptation of the armonica case, based on Watson’s bastardized account of it.

In truth, neither the armonica story nor Holmes’ Japanese sojourn is especially suspenseful or surprising, and might seem even less so were it not for the scrambled chronologies with which they unfold. Rather, the more vital subject of “Mr. Holmes” turns out to be our need for stories themselves and, in particular, the role of fiction as an escape from the pain and loss of everyday life — not least the compound horrors of two world wars. Only by his stubborn pursuit of the truth does Holmes come to understand the value of literary invention, from deerstalker hats and curved-stem pipes to our need for happy endings.

McKellen is predictably superb as Holmes, perhaps a touch too stentorious and Gandalf-y at times, but very touching in his sense of the old logician betrayed by his own logic. And Linney, in her third teaming with Condon (after “Kinsey” and “The Fifth Estate”), does beautifully understated work as a simple but proud woman trying to make sure she and her son have a future. The filmmaking itself is among Condon’s most elegant, with d.p. Tobias Schleisser’s widescreen lensing capturing the Sussex countryside in all its verdant splendor, and fine period detailing from production designer Martin Childs and costume designer Keith Madden. Editor Virginia Katz makes seamless braiding of the film’s multiple timelines. Composer Carter Burwell’s richly orchestrated score adds the perfect note of gentle mourning throughout.