War is hell, except when it’s purgatory.

General Glen McMahon (Brad Pitt) is good at war. At the start of David Michôd’s War Machine, McMahon’s just been assigned to fix the one in Afghanistan, using his years of expertise to bring an end to a seemingly intractable conflict. But the types of war he’s dealt with in the past bear little resemblance to what’s going on in Afghanistan.

Indeed, the US war in Afghanistan—a 15-year-plus conflict that’s still going on today—is as purgatory-like as wars come. It’s the longest war America has ever been involved in, but most people are probably still a little foggy on the details. A gross oversimplification: On the heels of 9/11, US troops entered Afghanistan in an attempt to subdue terrorist cells—specifically, the Taliban—but found a country that, annoyingly, didn’t want to govern itself the way the US thought it should. American forces were caught in a stalemate, training a reluctant Afghan army and trying to subdue insurgents, all the while ignoring the golden rule that any foreign army’s attempt to enforce rule of law, no matter how well-intentioned, will never, ever win the natives’ favor.

Although McMahon’s name is fictional, the character is based on the very real General Stanley McChrystal, who took command of the flailing Afghanistan conflict in 2009. War Machine is based on a Rolling Stone article and a book called The Operators written by the late journalist Michael Hastings—here named Sean Cullen, and played, mostly in voice-over, by Scoot McNairy. Hastings chronicled McChrystal’s command and his relationship with the men who worked under him, and although the names are changed, there’s little question this is intended to be a story that reminds one, uncomfortably, of real-life events: There’s the obvious Hillary Clinton proxy, and that’s an avuncular Anthony Michael Hall playing a stand-in for Michael Flynn, whose name was significantly less well known during War Machine’s production.

Hastings’s reporting wasn’t exactly complimentary of McChrystal and his crew, and correspondingly, Michôd injects dark satire into the intense rigor of military life, depicting how it invariably degenerates into boys-will-be-boys high jinks. Pitt’s McMahon thinks of himself as a creature of monastic discipline, jogging stiff-limbed through the camp each morning and rejecting his plush quarters in favor of a windowless closet. Pitt succeeds at playing up the impotence of the character’s Spartan, muscle-bound restraint, but as with many of his other leading performances, can’t quite make McMahon human, although his granite face and goofy growl make him very watchable.

The supporting cast, however, is excellent, with McNairy and Hall joined by standout Lakeith Stanfield (Atlanta, Get Out) as a disillusioned soldier on the front lines, and—in what’s either an inspired or deeply uninspired bit of casting, I can’t decide—Ben Kingsley as his real-life doppelgänger, Afghan president Hamid Karzai. This ensemble of boys and men is War Machine’s greatest strength, providing tight-knit comic timing.

The satire is occasionally a little toothless—it manages to be both too broad and too subtle at the same time—but the movie finds its footing in a solid third act, when the vagueness of McMahon’s plan for victory collides with the harsh reality of life in Afghanistan. The battle sequences play to Michôd’s directorial strengths, echoing the intensity of his excellent Animal Kingdom and The Rover. Even if War Machine isn’t quite the equal of those films, it has plenty to say about the embarrassing limitations of our country’s top-down military strategy, and says it smartly. recommended