LEGO my ego: Batman (voiced by Will Arnett) learns to accept help from Robin (voiced by Michael Cera) in The LEGO Batman Movie.

Warner Bros. Pictures

Batman has been in need of a great unburdening. It became necessary after Christopher Nolan's trilogy posited the Caped Crusader as a hulking avatar of turn-of-the-millennium anxiety. And it grew even more urgent after the drudgery of Batman v. Superman: Dawn of Justice, which was like chasing the heaviest meal of your life with a fully loaded, twice-baked potato. Over the last 50 years, Batman has crossed the spectrum from the campy, freewheeling POW! of the 1966 TV version to a grim-faced, gravel-voiced bulwark against festering corruption, urban blight, and existential malaise. Only the Joel Schumacher versions, Batman Forever and Batman & Robin, tried to Batusi in the other direction, but the backlash only catapulted the hero further into darkness.

In the exceedingly busy world of 2014's The LEGO Movie, Batman languished several names down the cast list, serving as the super-cool boyfriend standing between its dimwitted hero and the Master Builder of his dreams. But it advanced one small, important insight: Batman had become kind of a self-obsessed jerk and wouldn't it be funny to point this out to an audience that blithely accepted him as the hero of our times? As voiced by Will Arnett, Batman was re-conceived as a variation on other Arnett characters like Devon Banks on 30 Rock or Gob on Arrested Development, masking insecurity and ignorance with thundering arrogance and bravado.

The LEGO Batman Movie is perhaps the best possible thing that could have happened to Batman and to DC, which has suffered for its humorlessness as Marvel movies have playfully cracked wise. In the spirit of the first movie — and of the act of playing with LEGOs themselves — the freedom to deconstruct and rebuild outside conventional parameters has the effect of liberating Batman, making him fun and self-deprecating again. In fact, the arc of the story itself feels like a gradual unwinding of the clock, taking him from a surly, joyless echo in the Batcave to someone with the humility to be a team player.

The self-deprecation starts before the Warner Brothers logo even appears. "All important movies start with a black screen," snarls Batman in the voiceover, primed to add another world-saving adventure to his mythological résumé. Once he does appear, however, the film etches a sad portrait of superhero bachelordom, with Batman as a Charles Foster Kane type who slumps home to an empty Xanadu and eats microwaved lobster thermidor in front of Jerry Maguire (which he takes as a comedy). With Gotham City once again under attack by the Joker (Zach Galifianakis) — and a wealth of major and minor villains in the Batman catalog, on top of appearances by the Eye of Sauron and other off-brand nemeses — the Caped Crusader can barely hide his boredom behind his mask. When the threat gets overwhelming, he reluctantly learns to work with a team that includes his devoted butler Alfred (Ralph Fiennes), his adopted son Dick Grayson (Michael Cera), and the glamorous new police commissioner Barbara Gordon (Rosario Dawson).

The first LEGO Movie turned a philosophical battle over the blocks themselves — are they better as meticulous, step-by-step model construction or a playground of creativity? — into a metaphor for the pleasures of nonconformity and free discovery. With that matter resolved, TheLEGO Batman Movie doesn't have to fuss over the rules, leaving director Chris McKay (Robot Chicken) and his battery of screenwriters to move the fake-plastic pieces around the board without holding anything sacrosanct. Figures from The Lords of the Rings and The Wizard of Oz can, indeed, wriggle around in the same cinematic space as DC legends because the children who accumulate these toys have no reservations about it.

The nonstop flurry of gags and references, on top of the hectic business of Gotham City literally breaking in two, is mostly a strength, especially for those steeped in comics and pop culture knowledge. The consequence is a structural looseness that would drive Will Ferrell's father in The LEGO Movie crazy, though any flabbiness resulting from the devil-may-care storytelling is a fair trade-off for a film so enthusiastic about screwing around. Batman desperately needed to loosen up and have a good time, and the the film throws a rager of a party around him.