The image of a boyish Christian tailor befriending a man-eating lion by removing a thorn from its paw, then dazzling Caesar into mercy when they re-meet and embrace in a bloody Coliseum, made the movie version of George Bernard Shaw’s Androcles and the Lion a childhood favorite when it rolled out in syndication on 1950s television. (The casting also helped: Alan Young, future co-star of the talking horse, Mr. Ed, played Androcles.) At a later age, some of us would savor the Shavian paradoxes about faith and power, placed brilliantly in a context where Christianity is heresy. What entranced youthful baby boomers was a scrawny lad forging a bond with the King of the Jungle by treating him empathetically, upending the beliefs and mores of a cruel and rigid Roman empire. The somewhat frayed spectacle of the modest black-and-white movie, from 1953, was perfect for the boxy, monochromatic confines of mid-century TV.

Dean DeBlois’s elating How to Train Your Dragon cartoon trilogy (an original narrative woven out of Cressida Crowell’s Young Adult book series), set in a fantasy Scandinavia during the Viking Age, starts out as a boy-meets-dragon comedy-drama. It develops into an eccentric, marvelous expansion of Shaw’s Androcles playbook, from its protest against man’s inhumanity to animals to its celebration of gentleness under pressure as the supreme form of courage. DeBlois’s protagonist, the resourceful boy-mechanic Hiccup (Jay Baruchel), shares the spotlight with his dragon, a “Night Fury” he calls Toothless (for his retractable teeth). Uncannily intuitive (also lethal), the Night Fury could never be a mere pet. He’s the uncrowned monarch of dragondom—the last of his kind and the fastest, cleverest, and deadliest of them all. With scalloped wings as wide as 200 bats and a head and body built like a black panther’s for grace and speed, he’s the stuff of Viking nightmares until Hiccup proves him to be a profoundly caring creature. Then he becomes the catalyst of dragon-human co-existence and Hiccup’s muse for geographic exploration and innovative technology.

In the first movie, Hiccup forges a prosthetic tail-fin for Toothless and a harness for Hiccup to fly him. (Hiccup later loses a foreleg, just as Toothless lost a fin.) Then he revolutionizes the hunter-warrior Viking ethos of his chieftain father Stoick (Gerard Butler) and the structure of their craggy village, Berk. Berkians turn from tracking down dragons and killing them to welcoming them into the village and integrating them into society. In HTTYD 2, Berk becomes a mini-utopia, as each resident lavishes love and attention on his or her own dragon while uniting against would-be conquerors trapped in dated blood-and-guts concepts.

In The Hidden World, threats to paradise emerge from within and without. As Hiccup and his followers keep liberating dragons from less-enlightened Vikings,  Berk’s infrastructure sags under an exploding population. When word gets out that Berk has become a magnet for flying serpents, a consortium of warlords prepares to conquer it in order to destroy or enslave its fantastic beasts. They believe the only good dragons are dead dragons—except those the warlords drug and brainwash into killing other dragons for them. Panicked at the sight of Hiccup riding the Night Fury, the warlords hire a ringer to take Toothless down: Grimmel (F. Murray Abraham), a master dragon-slayer and champion of the old order. He wants to make Vikings great again. Like so many progressive leaders, Hiccup feels that the arc of history bends toward justice. He also knows that it may not curve that way in time for him and Toothless to live happily ever after.

DeBlois’s confident, extravagant animation combines muscular force with doodling whimsicality. He conjures intoxicating tableaux out of roaring seas, Northern lights and mists, and ruddy, green-specked mountain isles. (Cinematographer Roger Deakins once more serves as visual consultant.) The movie teems with dragons big and small who boast svelte physiques or sumo-wrestler bellies, exaggerated beaks or smooth round bobbleheads, gnarly fangs or scissor-like choppers, falcon-like talons or chicken-like claws. Toothless remains a beguiling creation, capable of clicking in a zeptosecond from wide-eyed daffiness to slit-eyed wrath.

The Hidden World derives its most enduring charm from the freewheeling spectacle of Hiccup and Toothless evolving into smart and brave leaders of their species while riding a whirlwind adolescence. It takes the whole movie for Hiccup and his clear-headed true love Astrid (America Ferrera) to get beyond kisses on the cheek. The film’s digital wizardry is so advanced that we can watch Hiccup’s peach fuzz grow into the semblance of a beard. Meanwhile Toothless falls snout-over-tail for a lissome “Light Fury” who rouses his atavistic urges. (She’s like a sleeker, softer version of himself—more a snow leopard, her creators say, than a panther.) From that moment on, Hiccup and Toothless stumble into maturity on separate, parallel tracks.

Happily, their instincts intersect. Hiccup decides that he can insure the safety of Berk’s dragons only by returning them to their ancestral lair—if he and Toothless can find it. He imagines that his Vikings can live there, too, but in this thoughtful fantasy, the hero’s dreams don’t always get realized. DeBlois has capped the series with a propulsive coming-of-age quest movie that completes Toothless’s odyssey. Hiccup’s mission to improve human-dragon relations ends on a sweet and melancholy note.

These movies have always dramatized the philosophy that it takes a village to raise a chieftain. Series fans will welcome the re-appearances of Hiccup’s dragon-whisperer mother Valka (Cate Blanchett), who discovers a hundred-ship enemy flotilla on a scary scouting mission, and the boisterous, jabbering blacksmith Gobber (Craig Ferguson), who plays straight man to fecund swarms of slapstick hobgoblins. The squat, hefty Snotlout (Jonah Hill), an overcompensating braggart, nurses a crush on Valka and insults the stalwart “Eret, son of Eret” (Kit Harington), while the roly-poly Fishlegs (Christopher Mintz-Plasse), unexpectedly maternal, appends a kangaroo pouch to his armor so he can carry a dragon pup everywhere.  (He says he can’t find a sitter.) What would a trip to Berk be without low-comic siblings Tuffnut and Ruffnut (Justin Rupple and Kristen Wiig, respectively)? Tuffnut incongruously coaches Hiccup on manliness while wearing a magnificently fake beard: he’s an archetypal alpha-lug. Wiig turns Ruffnut’s randy, annoying self-absorption into satiric arias of desperate girlhood, none giddier than her riff on the superiority of oval faces like hers to round faces like Astrid’s.

An undercurrent of wit electrifies the action. DeBlois designs the opening pitched battle so that every time our heroes stumble, they pull off inadvertent coups de grace. Throughout the film, Hiccup saves the day by flexing his sympathetic imagination rather than his muscles. At the climactic moment, he chooses to plummet from the sky in an act of ultimate sacrifice that serves as a “trust fall” exercise for himself and the Light Fury. In these scenes, the director and his animation team bring their own rousing pace and exuberance to choreography reminiscent of silent swashbucklers and clowns. In one sublime romantic moment, Toothless clambers up a tree to keep the Light Fury in sight the way Harold Lloyd does while watching Jobyna Ralston walk away in The Kid Brother. In the movie’s most extensive, inspired comic setpiece, Toothless courts the Light Fury with a wacky riff on the Bird of Paradise mating dance. He wins her heart by revealing the soul of an artist: grabbing a stick in his mouth, he traces her portrait in the sand.

Since these filmmakers don’t tease or cheat, it’s no spoiler to say that our heroes make it to the Hidden World. In its own semi-psychedelic style, for sensual and emotional impact, this sequence rivals the introduction of Shangri-La in Capra’s Light Horizon or Kafiristan in Huston’s The Man Who Would Be King: the dragons’ hideaway land registers as a stupendous, nonstop light show. Toothless is black and the Light Fury creamy white, but the assembled dragons’ iridescent scales externalize the ruling couple’s strength and passion. Facing their glittering, fire-breathing audience, Toothless and his mate are every foot the king and queen.

In a pithy afterword to Androcles and the Lion (not to be confused with its famous, discursive preface), Shaw salutes the “inner light’” of people who seek “the possibility of a better world based on the demand of the spirit for a nobler and more abundant life.” Without fancy rhetoric or pretensions, that’s what DeBlois does in HTTYD 3. He lights his humans and dragons from within.

Michael Sragow is a contributing editor to Film Comment and writes its Deep Focus column. He is a member of the National Society of Film Critics and the Los Angeles Film Critics Association.