With a lugubrious whimsy that becomes characteristic, Netflix’s “A Series of Unfortunate Events” starts by going to great, ironic lengths to convince the viewer to not watch the show. Narrator Lemony Snicket (Patrick Warburton), who wanders in and out of scenes like a melancholy Rod Serling, begins the series with a long, odd disclaimer that is part comedy, part tragedy. The theme song’s chorus is simply “Look away!” repeated over scenes of the perils the main characters have encountered. Lead Neil Patrick Harris, who plays the villainous Count Olaf, brazenly breaks the fourth wall to comment on the poor quality of streaming television drama. And periodically, just to remind the viewer what they’re in for, Warburton’s Snicket returns to re-up his warning: “Hello, my name is Lemony Snicket, and I am sorry to say that the alleged entertainment you are watching is extremely unpleasant.”

Tonally, “A Series of Unfortunate Events” is a weird, wonderful masterpiece — a self-consciously droll gothic dramedy that might be what would happen if Wes Anderson and Tim Burton decided to make a television series about children together. The series is based on the massively popular children’s books of the same name, written by Lemony Snicket, the pen name of author Daniel Handler (who is also an executive producer on the series). The story follows the three Baudelaire children, precocious orphans who stand to inherit a fortune when the eldest, Violet (Malina Weissman), turns 18. But it’s four long years until then, and in the meantime, the three are persecuted innocents, dogged by the wicked Count Olaf (Harris) who tries to imprison them, kill the baby Sunny (Presley Smith), marry Violet, and sabotages every effort the children make to connect to other adults.

It’s dark. The most difficult element of “A Series of Unfortunate Events” is also the essence of its charm — its straightforward, unadorned recounting of the terrible things children are vulnerable to, precisely because they are young, innocent, and supposed to mind their elders. The Baudelaire children spend the entire series trying to get adults to take their well-founded fears seriously, as they are knocked about, tricked, stolen from, and sent to live in squalor. But even the best-intentioned adults around them are frail creatures, too — blinded by ambition, neuroses, or simple selfishness. Ultimately, the Baudelaires learn that they can only truly rely on themselves, and though that is a hard lesson for a children’s book, it’s a familiar one as well.

It can be nerve-wracking to accept how much danger the children are in, especially because Weissman, Smith, and Louis Hynes as Klaus are such talented actors. (Yes, even the baby. How does a baby steal a scene? I don’t know, but there you have it.) But as the show settles into its own paces, it matches its surreal set pieces with a wry, cynical sense of humor that sees Harris in increasingly terrible disguises and Warburton explaining with excruciating detail the difference between “figurative” and “literal.” It’s upsetting, but it’s funny and immersive. And as the children grow to be a bit less innocent — and a bit more self-sufficient — it becomes easier to enjoy the show’s commentary on adulthood, which can so often be a way for flawed people to entrench in their faults, rather than evolve away from them.

Harris has the hardest job of the cast, and he only somewhat carries it off. The Count has to land somewhere between actually evil and whimsically harmless, which is a tall order for anyone that is, you know, real. As a result, the first few episodes struggle under the weight of Olaf’s rampant, obvious badness, as the children are sent to clean tubs with toothbrushes like misbehaving, penitent Scientologists before the whole company breaks into song. But the first season spans storytelling from the first four books — making each book into a two-episode long odyssey, and allowing the viewer to move on from one bad situation to the next without getting too depressed. Aasif Maandvi, as herpetologist Montgomery Montgomery (yes, that’s really his name) is a ray of sunshine in the third episode, and a welcome antidote to the show’s otherwise grim tendencies. The series is studded with fantastic guest performances, from Joan Cusack in a cartoonishly silly judge’s wig to Alfre Woodard as a woman who lives on a precipice but is afraid to turn on her stove. And it’s Warburton, really, who embodies and anchors the show’s narrative spirit, with a kind of straight-faced silliness that communicates both the tragedy and comedy of the series. In one brilliant sequence, he uses dramatic irony to explain dramatic irony with a solemn attention to bizarre detail that is both ludicrous and educational.

What’s best of all about “A Series of Unfortunate Events” is how every element of it — from the performances and set pieces to the detailed production design and steady pacing — come together to form a complete, considered vision. As the show well knows, it’s a super weird vision — which is why it encourages you, with a nod and a wink, to look away at all costs. But if you can stand to watch, “A Series of Unfortunate Events” is a bewitching modern fairy tale, with all the hexes and perils that pretty genre implies.