★★★★☆

THE endlessly ridiculous and the surprisingly witty get smashed together in this radiantly coloured, energetic piece of animated insanity based on the wildly successful illustrated children’s books by Dav Pilkey.

Harold (Thomas Middleditch) and George (Kevin Hart) are two overly imaginative classmates and inseparable best friends, famous around the school for their creative pranks, much to the chagrin of their inexplicably mean head teacher Mr Krupp (Ed Helms).

Their enthusiasm for mischief is only outweighed by their love of writing and drawing comic books, in particular those featuring their prized creation: the heroic but dim-witted Captain Underpants.

When Mr Krupp has finally had enough of their shenanigans and threatens to put them in separate classes (dun, dun, dun!), Harold and George accidentally hypnotize him using a ring from a cereal box and discover they have the ability to make him do anything they want at the snap of their fingers.

They soon decide to turn him into the eponymous hero himself, announcing with his earworm catchphrase “tra-la-laaa!” just in time to save the school from the villainous new science teacher Professor Poopypants (Nick Kroll) who looks and talks like a silly caricature of Albert Einstein and wants to literally eradicate all laughter.

Everything is on the menu that you might expect from a movie called Captain Underpants – fart gags and The Three Stooges-esque slapstick are as much a part of the fabric of the film as the titular hero’s Y-fronts.

But with a consistently sharp, dedicatedly absurdist and zealously fast-paced script by Nicholas Stoller (The Muppets), it finds a really effective balance between low-brow toilet humour and high-grade wit.

The infectious sense of energy is well-suited to the bright and colourful style of animation which merges old-fashioned sensibilities into a rounded, almost inflatable aesthetic that’s really nice to look at.

While it might be titled after the egg-headed hero, the main focus is actually on the friendship between Harold and George.

In its own way – amidst the unashamedly juvenile gags and increasingly over-the-top scenarios that fittingly feel like they’re straight out of a hand-drawn comic book – it has genuine things to say about childhood friendship and how laughter can be the best medicine, even if that means snickering at the name Professor Poopypants.

Eye-catchingly animated, unfailingly funny and gloriously self-aware, this is one of the year’s biggest pleasant surprises and an absolute joy from start to finish. Captain America who?

The film is in cinemas from Monday, July 24