Early in “The Fellowship of the Ring,” the first film in Peter Jackson’s monumental “Lord of the Rings” trilogy, the wizard Gandalf finds himself alone in a room with the trinket that could end the world. It lies gleaming on the floor, and Gandalf regards it with an attitude of fascinated fear. The audience feels a chill that neither Jackson’s vertiginous camera angles nor Ian McKellen’s arching eyebrows can fully explain. The Ring of Power extends its grip through the medium of music, which is the work of the gifted film composer Howard Shore. In the preceding scenes, an overview of the habits of hobbits, Shore’s music had an English-pastoral, dance-around-the-Maypole air, but when the ring begins to do its work a Wagnerian tinge creeps in—fittingly, since “The Lord of the Rings” dwells in the shadow of Wagner’s even more monumental “Ring of the Nibelung.” J. R. R. Tolkien’s fans have long maintained a certain conspiracy of silence concerning Wagner, but there is no point in denying his influence, not when characters deliver lines like “Ride to ruin and the world’s ending!”—Brünnhilde condensed to seven words.

Shore manages the admirable feat of summoning up a Wagnerian atmosphere without copying the original. He knows the science of harmonic dread. First, he lets loose an army of minor triads, or three-note chords in the minor mode. They immediately cast a shadow over the major-key music of the happy hobbits. (A digression for those who skipped grade-school music class or never had one: Why does the minor chord make the heart hang heavy? First, you have to understand why the major triad, its fair-haired companion, sounds “bright.” It is based on the spectrum of notes that arise naturally from a vibrating string. If you pluck a C and then divide the string in half, in thirds, in fourths, and so on, you will hear one by one the clean notes that spell C major. Wagner’s “Ring” begins with a demonstration: from one deep note, wave upon wave of majestic harmony flows. The C-minor triad, however, has a more obscure connection to “natural” sound. The middle note comes from much higher in the overtone series. It sets up grim vibrations in the mind.)

The minor triad would not in itself be enough to suggest something as richly sinister as the Ring of Power. Here Wagner comes in handy. He famously abandoned the neat structures of classical harmony for brooding, meandering strings of chords. In the “Ring,” special importance attaches to the pairing of two minor triads separated by four half-steps—say, E minor and C minor. Conventional musical grammar says that these chords should keep their distance, but they make an eerie couple, having one note (G) in common. Wagner uses them to represent, among other things, the Tarnhelm, the ring’s companion device, which allows its user to assume any form. Tolkien’s ring, likewise, makes its bearer disappear, and Shore leans on those same spooky chords to suggest the shape-shifting process.

In “The Return of the King,” which opens this week, Shore’s music keeps pace with the burgeoning grandeur of the filmmaking. When the hobbits escape Mt. Doom, Renée Fleming sings, in Elvish. As the evil lord Sauron comes to grief, the dusky harmonies of the ring give way to their mirror image in the major key. There is an abrupt harmonic shift that has the effect of sun breaking through clouds. You would have thought that sometime between the birth of Stravinsky and the publication of “Alexander’s Ragtime Band” such echt-Wagnerian material would have gone out of fashion, but there is life in the fat lady yet.

Tolkien refused to admit that his ring had anything to do with Wagner’s. “Both rings were round, and there the resemblance ceased,” he said. But he certainly knew his Wagner, and made an informal study of “Die Walküre” not long before writing the novels. The idea of the omnipotent ring must have come directly from Wagner; nothing quite like it appears in the old sagas. True, the Volsunga Saga features a ring from a cursed hoard, but it possesses no executive powers. In the “Nibelungenlied” saga, there is a magic rod that could be used to rule all, but it just sits around. Wagner combined these two objects into the awful amulet that is forged by Alberich from the gold of the Rhine. When Wotan steals the ring for his own godly purposes, Alberich places a curse upon it, and in so doing he speaks of “the lord of the ring as the slave of the ring.” Such details make it hard to believe Tolkien’s disavowals. Admit it, J.R.R., you used to run around brandishing a walking stick and singing “Nothung! Nothung!” like every other besotted Oxford lad.

It is surely no accident that the notion of a Ring of Power surfaced in the late nineteenth century, when technologies of mass destruction were appearing on the horizon. Pre-modern storytellers had no frame of reference for such things. Power, for them, was not a baton that could be passed from one person to another; those with power were born with power, and those without, without. By Wagner’s time, it was clear that a marginal individual would soon be able to unleash terror with the flick of a wrist. Oscar Wilde issued a memorable prediction of the war of the future: “A chemist on each side will approach the frontier with a bottle.” Nor did the ring have to be understood only in terms of military science. Mass media now allowed for the worldwide destruction of an idea, a reputation, a belief system, a culture. In a hundred ways, men were forging things over which they had no control, and which ended up controlling them.

Tolkien began “The Lord of the Rings” in the wake of the First World War, whose carnage he experienced firsthand, and he finished it in the wake of the Second. In both wars, he witnessed the wedding of Teutonic mythology to German military might. He bemoaned how the Nazis had corrupted “that noble northern spirit.” You could see “The Lord of the Rings” as a kind of rescue operation, saving the Nordic myths from misuse—perhaps even saving Wagner from himself. Tolkien tried, it seems, to create a kinder, gentler “Ring,” a mythology without malice. The “world-redeeming deed,” in Wagner’s phrase, is done by the little hobbits, who have no territorial demands to make in Middle-earth and wish simply to resume their gardening. In the end, the elves give up their dominion, just as, in Wagner, the gods surrender theirs. Yet it is a peaceful transfer of power, not an apocalyptic one. The story ends not with the collapse of Valhalla but with the restoration of a wasted world.

It is probably heretical to suggest that the “Lord of the Rings” films surpass the books on which they are based. (Correspondence on this subject may be addressed to Alex Ross, The North Pole.) The books tell a fantastic story in a familiar style, but the movies transcend the apparent limitations of their medium in the same way that Wagner transcended the limitations of opera. They revive the art of Romantic wonder; they manufacture the sublime. I hope that at least a small fraction of the huge worldwide audiences for these films will one day be tempted into Wagner’s world, which offers something else again. For Tolkien, myth is a window on an ideal world, both brighter and blacker than our own. For Wagner, it is a magnifying mirror for the average, desperate modern soul.