At last we’re beginning to get films about the Afghan-Iraq wars of the quality that the sacrifices made by the soldiers and their families deserve. “The Hurt Locker” was a primary example; “The Messenger” is another.

Ben Foster plays Sgt. Will Montgomery, who returns from Iraq an injured hero, credited with saving most of his company from an IED. With only a few months left in his term of service, he’s assigned to team with Captain Tony Stone (Woody Harrelson), who has the unenviable job of Casualty Notification Officer—the one who must tell next of kin in person of the deaths of their loved ones in battle.

Montgomery, who’s conflicted about his actions in Iraq and unhappy about the assignment—as well as put off by the gruff, steely Stone and still pining over the loss of his ex-girlfriend Kelly (Jena Malone), who’s marrying an old buddy—has trouble controlling his emotions as the older man, hardened to the job, teaches him the ropes. Their initial stops are predictably wrenching, with one—featuring Steve Buscemi as a father enraged at word of his son’s death—particularly powerful, though all are affecting.

“The Messenger” isn’t exactly strong on plot, being more an episodic character study. But the script follows two fundamental lines. One deals with Montgomery’s attraction to Olivia Pitterson (Samantha Morton), a widow who receives news of her husband’s death with an unusually stoic demeanor. What follows couldn’t be called a romance, but it does represent the sort of emotional attachment Stone impresses on the younger man as the most important thing to avoid.

The second thread, of course, deals with a growing understanding between Montgomery and Stone, mostly articulated in after-hours outings that reveal the demons troubling each of them (but also have moments of humor, too). The revelation of Montgomery’s guilt over the death of a comrade he was trying to save serves as a means of helping to lance a festering wound, and Stone’s admissions about his alcoholism and feelings of inadequacy at never having been in real combat, combined with his efforts to find release from the pressures of the task he has to perform, offer insight into his psyche as well.

There are moments when working out these plot lines threatens to go awry. The Foster-Morton relationship is handled with becoming modesty, avoiding the mawkishness it might have easily invited, especially in the scenes featuring the woman’s young son. But the Montgomery-Stone one does move into territory that comes close to shattering the carefully maintained tone of realism, especially in an ill-advised trip by the pair to Kelly’s wedding. But a culminating talk between the two men, ending in Stone’s realization of the tragedy he’s involved with, pulls the film back on track.

The performances are all excellent, with Foster moderating his customary wildness to express the underlying melancholy of a man injured in spirit as well as body. And the physicality of his turn in scenes when he’s thrashing about in his motel room, wrestling with his memories, has an astonishing degree of power. Harrelson gradually progresses from a near caricature to capture a man far more uncertain and tortured than he’d ever care to admit. No one else has nearly as much to do, but Morton handles her role with quiet grace, and Buscemi takes every advantage of his two-scene cameo.

There’s nothing flashy about Bobby Bukowski’s camerawork, but its very ordinariness fits the material. And similarly Oren Moverman’s helming avoids ostentation in favor of a directness that serves the story well. It’s uncommonly astute work from a novice, and is in the final analysis the key to making “The Messenger” one of the most powerful and moving films about the human cost of the Afghan-Iraq war and about those of war in general to appear in years.