In each of the three movies Kenneth Lonergan has directed, characters move through their everyday lives under the shadow of death. The brother and sister played by Mark Ruffalo and Laura Linney in “You Can Count on Me” (2000) had, when they were children, lost their parents in a car crash, a trauma that rippled unspoken beneath their mundane adult interactions. The coming-of-age of Lisa Cohen, the New York teenager (Anna Paquin) at the center of “Margaret” (2011), was complicated by a fatal bus accident and colored by the aftermath of the Sept. 11 terrorist attacks.

Early in Mr. Lonergan’s new film, “Manchester by the Sea,” Lee Chandler (Casey Affleck) is summoned back to his hometown by news that his older brother, Joe, has died. Joe, an affable bear of a man (Kyle Chandler, in flashbacks), had had congestive heart failure for a long time, so his death, while wrenching and sad, could not have been entirely unexpected. What Joe’s 16-year-old son, Patrick (Lucas Hedges), and Lee face together might fall under the heading of ordinary grief: tragic to be sure, but manageable.

Lee, though, already lives with a much more extreme kind of pain. You can see it in his smallest gestures and hear it in his flat, careful diction. The force of his pent-up emotion is terrifying, and so is the self-control he must exercise to keep it invisible. Mr. Affleck, in one of the most fiercely disciplined screen performances in recent memory, conveys both Lee’s inner avalanche of feeling and the numb decorum that holds it back.

The source of his anguish is revealed about halfway through the film, which almost buckles, like Lee himself, under the weight of unimaginable horror.

How could anyone deal with such a disaster? How do you live with yourself afterward? Mr. Lonergan poses these questions not in the abstract, but as practical matters. Much of the action in “Manchester by the Sea” consists of dumb routines and petty disruptions, the kind of stuff that keeps happening even in the wake of enormous changes and dramatic upheavals. Before he learns of Joe’s death, Lee, who works as a janitor in a handful of apartment buildings near Boston, shovels snow, takes out the garbage and tackles plumbing problems.

Once he returns home to look after Patrick, whose mother (Gretchen Mol) is out of the picture, things become a little more unpredictable. Lee has to meet with lawyers and funeral directors. He drives his nephew to band practice and heats up leftover pizza in the microwave. He forgets where he parked the car. He has to figure out what to do about Joe’s commercial fishing boat and what to say about Patrick’s complicated romantic situation.

A lot happens, and a surprising amount of it is very funny. Mr. Lonergan, a brilliant playwright and a sought-after script doctor, is a master of the quotidian absurd. In his work, the laws of the universe are rigged to make human beings look ridiculous, and the species is internally wired to produce the same effect, so no amount of good taste or moral discipline can stop the jokes from coming. In Lee’s earlier life, when he lived with his wife, Randi (Michelle Williams), and their three children, he was a joker, the mischievous, wisecracking life of his own roving party. Even in his stunned, spiritually crippled later condition, the habits of sarcasm and chop-busting stick with him like phantom-limb sensations. Joy may be out of reach, but he can’t help but find shards of humor wherever he looks.

This trait clearly runs in the family. Lee and his nephew, thrown together by bereavement, have the makings of a comedy team.

They’ve got a million of them. But Mr. Lonergan isn’t trafficking in bittersweet sitcom beats. He’s after a kind of realism rarely found in recent American movies, which often seem to think that audiences will be confused or offended when the silly and the serious collide onscreen.

“Manchester by the Sea” is a finely shaded portrait, a study in individual misery set in a place that is observed with care and affection. Mr. Affleck and Mr. Hedges are exceptional, but the rest of the large cast is nearly as fine. (I’d single out Ms. Williams, Ms. Mol and C. J. Wilson, who plays Joe’s best pal and business partner.) The coastal Massachusetts town that gives the movie its name is picturesque in a modest, thrifty New England way. Not breathtaking, but calm and orderly, its hills flecked with tall deciduous trees and clapboard houses, its harbor ringed with low-slung, rocky islands.

In the opening scene — a memory of Lee, Patrick and Joe out on the boat under a bright blue sky, teasing and roughhousing and trying to catch a fish — it’s heaven. Later it feels like purgatory, a wintry place with flat skies, leaden waters and unwelcome reminders of the past. (The cinematographer who deftly captures this rough beauty is Jody Lee Lipes.)

But “Manchester by the Sea” is not only about Lee and his family, and not only about their houses and boats and drinking habits and marriages. It is also about what all those things mean, and what kinds of sentimental and ideological value are attached to them. The movie takes up, indirectly and perhaps inadvertently but powerfully and unmistakably, a subject that has lately reinserted itself dramatically into American political discourse. It’s a movie, that is, about the sorrows of white men.

I’m not being dismissive. I’m being specific. Mr. Lonergan is too astute about the textures of American life to assume that the racial and class identities of his characters are incidental or without larger significance. That was true of the rich New York kids in Mr. Lonergan’s play “This Is Our Youth,” from 1996, and it’s no less true of the grown-up citizens of the Commonwealth of Massachusetts here, even if they are too diffident or too busy for sociological self-consciousness.

In 21st-century American cinema — from “Mystic River” to “Gone Baby Gone,” from “The Fighter” to “The Departed” — the Bay State is where the myths of post-ethnic -class white identity have been forged. Nonwhite characters are as scarce as fully articulated r’s, and the uncomfortable racial history that has existed in reality (the Boston busing battles of the 1970s, for instance) is easily ignored. There is no legacy of slavery or Jim Crow, and therefore an aura of innocence can be maintained amid the dysfunction and sentimentality and clannishness.

“Manchester by the Sea,” partly because it is a product of the Damon-Affleck industrial complex, partakes of some of this myth-mongering, but it also resists the more tiresome clichés of the blue-collar Boston movie. (There are moments when the exploitation of the local accent verges on parody. Why else write an extended argument over the merits of “St-AH Trek” or a series of jokes about sh-AH-ks?) Mr. Lonergan is more interested in guilt than in criminality, and less concerned with nostalgia than with the psychology of loss.

This is not a pseudo-epic of redemption or revenge, with boxers and gangsters and their churchgoing moms and wives. It’s a masculine melodrama that doubles as a fable of social catastrophe. Lee, Joe and their friends would never define themselves as privileged. They have proletarian tastes and sensibilities. But they also have paid-up houses and boats, kids on track for college, decent medical care and an ironclad entitlement to the benefit of the doubt. (Observe what happens to Lee in the Manchester police station and you’ll see what I mean.) Their main problems come from women, who spoil the parties, don’t get the jokes and sometimes can’t control their drinking or keep their pants on. Some are good moms or good sports, and anyway, a man can always steal away to the boat or the basement with the guys and some beers.

Cast out of this working man’s paradise, Lee is also exiled from the prerogatives of whiteness. He lives in a basement room, earning minimum wage, answering to an African-American boss and accepting a tip from a black tenant whose toilet he has cleaned and repaired. He doesn’t complain, but it is also clear that he has chosen these conditions as a form of self-abasement, as punishment for his sins.

Maybe its sounds like I’m over-reading, or making an accusation. But to deny that “Manchester by the Sea” has a racial dimension is to underestimate its honesty and overlook its difficult relevance. Lee is guilty and angry, half-convinced that what happened was not his fault and half-certain that it was, unable to apologize or to accept apologies, paralyzed by grief and stung by a sense of grievance. He’s broken, and he’s also smart enough to realize — and Mr. Lonergan is wise and generous enough to allow him to understand — that nothing will make him whole again.