Even before the violated corpse of a little girl comes to light, the first glimpse of Jack Nicholson’s face suggests that Sean Penn’s “The Pledge” will not be the feel-good movie of the year.

Although marketed as a conventional serial-killer thriller, “The Pledge” scores its greatest successes as an atmospheric examination of its aging hero, a Nevada detective named Jerry Black.

Within hours of Jerry’s retirement, a seven-year-old girl is found raped and murdered in the forest nearby. Seizing the opportunity to investigate, Jerry makes the title pledge to the victim’s mother, swearing “on his soul’s redemption” to bring the killer to justice. The oath takes on ever greater weight during the investigation, even as such redemption comes to seem increasingly unattainable.

In a lesser film, Nicholson’s present angst would be explained with a clumsily introduced backstory or a tell-all flashback. Penn and his writers, working from a novel by Friedrich Durrenmatt, tell us little about Jerry’s life beyond that which we can derive from the crags and pouches of Nicholson’s face.

Gone from Nicholson’s eyes is the demonic glint, the hint of mischief that has long given his characters their dark charisma. Nicholson’s wrinkles, liver spots, dangling chins, and thinning salt-and-pepper hair hint at the utter absence of vanity in the performance to come.

Eschewing scenery-chewing flamboyance, Nicholson here returns from his career as a great showman to remind us that he is foremost a great actor.

Jerry Black does not seem a like a case of past greatness gone to seed; rather Nicholson evokes the collision of festering mediocrity with the alienation brought on by encroaching age. Nicholson’s every movement radiates the gnawing discomfort of a man who finds himself ill at ease in his own skin.

Penn, long lauded for his gifts as an actor, shows great promise in this, his third directorial effort. Flawlessly attuned to his star’s gifts, Penn complements the performance with psychologically suggestive visual cues.

At a surprise party in his honor, Jerry is seen frozen, inert, as the party-goers around him mill around in a whirl of grotesque, frenzied activity. That image is echoed in a startling shot of thousands of chickens running around a coop, their cacophonous cries drowning out the detective’s words to the bereaved parents.

Penn sets Nicholson against a pantheon of stunning character actresses — Helen Mirren, Patricia Clarkson, Vanessa Redgrave — each offering a different shade of quiet dignity of a sort that Jerry never even approaches. Against the backdrop of their restrained elegance, the neurotic awkwardness of his every movement registers vividly.

An equally accomplished cohort of males, including Benicio Del Toro, Aaron Eckhart and Mickey Rourke, further evinces thwarted masculinity, half-defined despair and looming violence. The complementary functioning of marvelous performances is a privilege to behold.

As Jerry becomes increasingly obsessed with the case, the pervasive sense of melancholy slowly gives way to dread less rooted in the obvious violence than in the growing glimpses of the madness that hovers around the edges of its protagonist’s melancholy. But just as such insight begins to yield suspense, the film goes fatally slack.

Everything but Nicholson’s performance goes awry around the halfway point, where the film changes setting, style and tone. Although the film’s first half seems to suggest that Penn is evolving into a great director, the second hour shatters that hope with near-relentless cruelty.

Penn destroys the film’s intensity of atmosphere with frivolous visual flourishes, incorporating seemingly endless shots of natural beauty that not only prove redundant, but also dissipate the haunting atmosphere of mellow decay that permeates the film up to this point.

In a film so utterly dependent on subtleties of mood and hue, this change in visual scheme drains the film of its intensity and strips bare the familiar mechanics of its otherwise shopworn plot.

Penn eventually reverts to genre staples — chases and races to the rescue — that while competently executed, are too familiar to be deeply affecting, substituting tension for undertones of dread.

Worse yet, the film’s probing of Nicholson’s psychology stops short as the plot mechanics become more familiar. The film’s climactic twist depends on an understanding of his complex and increasingly twisted mental processes. The film ultimately proves too weak a vehicle to give Nicholson’s performance the impact it ought to carry.

Yet if “The Pledge” promises more than it delivers, it does leave one with a dazzling vision of its star’s gifts, and the hope that the talents of its director will eventually reach a fuller, more disciplined expression.