Correction: An earlier version of this review incorrectly described actor Willem Dafoe as a newcomer to director Wes Anderson’s ensemble of regular actors. Dafoe appeared in Anderson’s 2004 film “The Life Aquatic with Steve Zissou.” This version has been updated.

The Grand Budapest Hotel,” by Wes Anderson, is a compulsively arranged sacher torte of a movie, an elegant mousetrap of stories-within-stories that invokes history with a temperament ranging from winsome to deeply mournful.

As a carefully constructed miniaturized universe, “The Grand Budapest Hotel” is that most Andersonian of endeavors, evincing the deadpan drolleries, screwball action and dollhouse aesthetic that have alternately charmed and chagrined filmgoers for the past couple of decades.

Set in a castlelike hotel in the fictional Mitteleuropean country of Zubrowka on the eve of World War II, “The Grand Budapest Hotel” revolves — like all of Anderson’s films — around a quirky middle-aged man and the precocious boy he takes under his wing. As such, the film fully engages one of the fascinating tensions that have always animated Anderson’s fussily decorated cinematic jewel boxes, namely how one learns to become a man within a universe of characters so stylized and artfully concocted that they seem barely human.

The great good fortune of “The Grand Budapest Hotel” is that the tutor in question is played by Ralph Fiennes, who lends a lambent sincerity to a character who can be charming and rather loathsome at the turn of a schilling. Monsieur Gustave H., concierge at the Budapest, is a smooth, sinuously manipulative epitome of his craft, especially when it comes to his elderly female guests — who provide ample opportunity for Gustave to hone his gift for seduction and flattery.

Those gifts are on view even when the recipient is dead, as we see when Gustave and a young lobby boy named Zero Moustafa (Tony Revolori) embark on a fateful trip to honor a guest’s memory, and wind up embroiled in a zany murder mystery that will take them from a spooky, taxidermy-filled mansion to a cartoonish prison break to a vertiginous ski-and-sled chase from a mountaintop monastery.

More than 50,000 Legos used to create replica of Wes Anderson's "The Grand Budapest Hotel." The masterpiece weighs approximately 150 pounds and stands 7 feet tall and 6.5 feet wide. (Reuters)

Enlivened by such antic set pieces, “The Grand Budapest Hotel” finds Anderson at his most spirited and stylish: The story, told as a series of flashbacks, actually spans three distinct eras, each defined by its own color palette and aspect ratio (the 1930s sequences are set within the boxy, storybook-like frame of the time). Draped in extravagant shades of amber, rose and amethyst, as lovingly crafted and iced as the airy delicacies that Gustave eagerly devours from pink boxes tied with blue ribbons, “The Grand Budapest Hotel” bears Anderson’s now-unmistakable signature of bespoke, unapologetic devotion to craftily ordered prettiness.

The film also features cameos from Anderson’s informal rep company, including Bill Murray, Bob Balaban, Owen Wilson and an almost unrecognizable Tilda Swinton, as well as newcomers to the club F. Murray Abraham, Jude Law and Saoirse Ronan, among several others. They make for a gifted gaggle of players, each blessed with a great face, and Anderson choreographs them with the assured hand of a pro. But it’s Fiennes who provides the ballast — the gravitas and ambiguous soul — of an endeavor that otherwise makes a genteel, picturesque burlesque of Nazi-era anxieties. (According to an epigraph, “The Grand Budapest Hotel” was inspired by the writings of Stefan Zweig, an Austrian author who fled the country when Hitler came to power and later took his own life.)

Fiennes brings a magnificent sense of detail but also withholding to Gustave, who remains a cryptic figure — sexually omni-oriented, civilized, refined, but also prone to vulgarities and casual cruelties (especially regarding women he regularly beds). In fact, “The Grand Budapest Hotel” is shot through with startling images of violence, from a character off-handedly discarding a dead pet in a trash can to the sight of someone’s recently disembodied fingers. There’s also a brief glimpse of carnality that feels as shockingly out of place in a Wes Anderson film as a stop-motion fox might be in something by Michael Bay.

For all of his commitment to the finer things in life, Anderson is willing if not eager to indulge a fancy for the crude and grotesque, a juxtaposition that comes into even more curious play when he treats characters’ physical blemishes and deformities as mere elements, visual one-liners. Are the shoeshine boy with the prosthetic leg and the bakery girl with “a port wine stain the shape of Mexico” on her face supposed to convey Anderson’s humanism, or a more arch and sneakily contemptuous fetishistic tendency?

Even though melancholy threads through “The Grand Budapest Hotel,” it’s not a particularly deep film. Comparisons have been made to the wartime comedies of Ernst Lubitsch, but Anderson hasn’t created a playfully stinging satire as much as its softer mirror image. He convincingly mimics the gestures of the genre — abhorrence of authoritarianism, not as a crime against humanity but as an affront to good taste and Old World etiquette — but ultimately seems unable or unwilling to delve under the sumptuous surface and grapple with darker realities.

Still, “The Grand Budapest Hotel” is as enchanting, well-appointed and smoothly run as its titular establishment, and Gustave earns the right to be called a genuinely tragic figure. If Anderson buries relatively little moral substance under lavish dollops of rich cream, at least he, like his fascinating protagonist, sustains the illusion with a marvelous grace.

★ ★ ★

R. At area theaters. Contains language, some sexual content and violence. 99 minutes.