According to a child psychologist cited in a recent article in The Atlantic, “little boys’ imaginary friends are frequently characters who are more competent than they are, such as superheroes or beings with powers.” That more or less describes the case of 10-year-old Johannes (Roman Griffin Davis), who has dreamed up a powerful pal to boost his confidence at anxious moments, always ready with a fist pump or a shout of “you got this!” Perfectly normal, and even kind of adorable, even though Johannes’s imaginary friend is Adolf Hitler.

The make-believe Hitler is somehow both the most outlandish and the most realistic thing about “Jojo Rabbit,” Taika Waititi’s new film. Based on the novel “Caging Skies” by Christine Leunens — and featuring Waititi himself as Johannes’s goofball fantasy-Führer — the movie filters the banality and evil of the Third Reich through the consciousness of a smart, sensitive, basically ordinary German child . Veering from farce to sentimentality, infused throughout with the anarchic pop humanism Waititi has brought to projects as various as “Hunt for the Wilderpeople” and “Thor: Ragnarok,” it risks going wrong in a dozen different ways and manages to avoid at least half of them.