When Father James, the shambling, deeply humane protagonist of “Calvary,” returns to his monklike living quarters after celebrating Mass or making parish visits, he’s greeted by his only companion, a soulfully loyal dog, into whose fur the priest passionately buries his face, as if savoring the last vestige of sensual pleasure available to him.

In many ways Brendan Gleeson, who plays Father James in this atmospheric, theologically minded thriller, resembles that gorgeous animal: Shaggy and charismatic. He earns immediate buy-in from the audience.

This small-canvas portrait — of a sin-ridden community in County Sligo — possesses biting wit, idiosyncratic characters and a steadfast suspicion of reassuring sentiment, whether in the form of religious faith or random acts of human kindness. Father James is a modest, deeply humane man of the cloth: gruff, taciturn, utterly innocent of the cruelty, corruption and overweening pietism for which the Catholic Church has been criticized in recent years. He’s one of the good guys, a fact that cannot go unpunished in the course of “Calvary’s” carefully machined plot or, apparently, director-writer John Michael McDonagh’s own unforgiving imagination.

As “Calvary” opens, Father James, hearing the confession of one of his village’s inhabitants, is told that he’ll be killed one week from that Sunday — precisely because he’s guilt-free — a piece of news he receives with characteristic deadpan impassivity.

After deciding that going to the police would break the confidence of confession, Father James goes about his business, visiting the motley members of his parish in the hopes of uncovering the identity of his would-be assassin and turning his heart.

With each encounter, the citizens of Father James’ parish reveal themselves to be an exceptionally angry, cynical and dismissive bunch, from the explosively hostile butcher and his philandering wife, to a supercilious millionaire, the town’s resident Lothario and an arrogant physician. Nearly every commandment has been broken by his flock, including unspeakable crimes that Moses himself couldn’t have foreseen, let alone delivered.

Father James’ mood lightens a bit with the arrival of his daughter, played with damaged loveliness by Kelly Reilly. But she, too, inhabits a dark side that fits right into “Calvary’s” universe, a world of quiet despair tempered by Irish gallows humor.

As pungent as McDonagh’s writing is, it may be his too-easy pessimism that makes “Calvary” engrossing and thought-provoking, but not great. The filmmaker has fashioned a marvelous showcase for Gleeson at his most restrained and sympathetic, but the story ultimately feels too overdetermined, too manipulatively and schematically designed to be as profound as the filmmaker surely intended. It too often feels conveniently contrived to fit McDonagh’s agenda rather than organic.