Brendan Gleeson plays Father James in “Calvary,” a thriller about a Catholic priest who learns that someone intends to murder him. (Jonathon Hession/Fox Searchlight Pictures)

When Father James, the shambling, deeply humane protagonist of “Calvary,” returns to his monklike living quarters after performing 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, no matter what the movie happens to be, from the criminally underseen “Edge of Tomorrow” earlier this summer to “The Guard,” the darkly uproarious buddy film that he thoroughly dominated alongside Don Cheadle in 2011.

“Calvary” is something of a follow-up to that film, having also been written and directed by John Michael McDonagh. Like the previous effort, 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, McDonagh’s own unforgiving imagination.

As “Calvary” opens, Father James is hearing the confession of one of his village’s inhabitants; when the young man begins with a recollection of being molested as a boy, the priest wryly retorts, “That’s certainly a startling opening line.” Even more unsettling: The confession ends with Father James being 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. “Calvary” isn’t a whodunit, as McDonagh himself has said, it’s a who’s-gonna-do-it.

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

Father James’s 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 (and, it must be said, given earthy appeal by a soundtrack featuring the great Jackson C. Frank and Fred Neil, among others).

As pungent as McDonagh’s writing is, it may be his too-easy pessimism that makes “Calvary” engrossing and thought-provoking, but not great. As he did with “The Guard,” the filmmaker has fashioned a marvelous showcase for Gleeson at his most restrained and commandingly sympathetic, but the story ultimately feels too overdetermined, too manipulatively and schematically designed, to be as profound as the filmmaker surely intended. Even as portrayed by a terrific ensemble of actors, the townspeople wind up being caricatures of eccentricity — perhaps not as goofily appealing as in most small-Irish-town comedies but just as regrettably one-note in their waspish venality. (There are one or two respites by way of characters played by Marie-Josée Croze and M. Emmet Walsh.)

As forthright as “Calvary” is in addressing the church’s recent troubled history and the far more universal subjects of hypocrisy and spiritual malaise, it too often feels conveniently contrived to fit McDonagh’s agenda rather than organically lived and experienced. That weakness extends to the film’s dispiriting climax, in which the irony and fatalism that have driven “Calvary” forward reach an end point that, while doubtlessly dramatic, doesn’t jibe with the Father James we’ve come to know and love. While he may entertain his share of doubts, that Father James is a man of prayer rather than plot twists.

★ ★

R. At area theaters. Contains sexual references, profanity, brief strong violence and some drug use. 104 minutes.