The idyllic Swedish town of Ystad is the setting for this dark trilogy of 'Masterpiece: Mystery!' TV movies starring Kenneth Branagh as the eponymous flawed detective.

If you're considering a Scandinavian seaside vacation, it's probably best not to take it in Ystad, the Swedish town that provides the setting for "Wallander," a trilogy of 90-minute TV movies beginning Sunday on PBS' "Masterpiece: Mystery!" The bodies really pile up around there, something of a statistical anomaly when you consider that the murder rate in Sweden is a little more than one homicide per 100,000 citizens per year and the fact that Ystad has a population of only about 17,000. It's Hellmouth on the Baltic.

Based on a series of novels by Henning Mankell that have been translated into many languages and sold many copies around the world, "Wallander" stars Kenneth Branagh as the eponymous police detective, and it's good to see him. (Two different Swedish actors have already played the character.)

Apart from his Shakespeare adaptations, and even including some of them, Branagh's career choices have not always been commensurate with his talent as an actor. But if he's no longer a golden boy, there's something about him as he creeps up on 50 that's even more appealing, and he makes a neat fit for the gone-to-seed, world-weary Wallander, who no longer knows why he does what he does but works even harder at it to avoid dealing with his inability to sort out his own life.

I recommend the series, though Sunday's opening film, "Sidetracked," does present a bit of a stumbling block. It is stylized to a fault, a riot of saturated color, reflections, distortions, and arty shallow focus that might work for the length of a music video or pharmaceuticals ad, but is distracting and distancing across the course of a feature film. (The cinematography is by Anthony Dod Mantle, who photographed "Slumdog Millionaire.")

There was possibly some intent to contrast the darkness of the stories with the beauty of the location -- the first thing that happens here is that a girl sets herself on fire in a gorgeous field of yellow grain. (It's the Strindberg/ABBA dichotomy, to put it in Swedish cultural terms.) Even the police station is a magazine-ready haven of lovely Scandinavian design.

But there is creating mood and there is showing off, and "Sidetracked" is so visually hyper that the players seem to be overacting even when they're sitting and staring into space -- and there is quite a lot of that, as Wallander is rendered speechless by the unraveling of the Swedish social order.

The second and third films, "Firewall" and "One Step Behind," are less mannered than the first, and that they are all based on novels protects them from some of the more predictable turns and twists of TV crime drama; they take on teenage prostitution, anarchy in the computer age, and an old-fashioned serial killer, with a good deal of suspense.

But what makes "Wallander" memorable in the end is the arc that underlies them -- the detective's own story as he plummets toward emotional and physical crisis.

Branagh contrives to look worse as the series goes on. Living alone, about to be divorced, out of shape, unshaven, unwashed, unwell and falling asleep everywhere but in a bed, he's been a good policeman but a bad husband, father, son and friend. (David Warner makes a memorable appearance as Wallander's own father, an artist on the edge of dementia.)

It is also a kind of murder, these stories suggest, to isolate yourself from others -- a crime for which the solution always lies within.