“Beirut,” a tense, moodily stylish political thriller set in 1982 amid the chaos of Lebanon’s civil war, stars Jon Hamm as a former U.S. diplomat who, 10 years after leaving the country in the wake of personal tragedy, is called back to negotiate for the release of one of his erstwhile colleagues, a CIA operative who has been taken hostage by one of the area’s myriad and ever-metastasizing factions.

Directed by Brad Anderson (“The Machinist”) from a script by Tony Gilroy (“Michael Clayton”), “Beirut” bears the stamp of each filmmaker, propelled by Gilroy’s instinctive knack for keeping a clear, coherent story in constant forward motion, and executed with Anderson’s unfussy approach to visuals and character cues.

By the time Hamm’s Mason Skiles is pulled back into duty, he has been working in the relatively sedate world of labor-management mediation in Boston. In those sequences, Hamm affects the sodden alcoholic dejection of Paul Newman in “The Verdict.” That same sense of benumbed fatalism follows him to the film’s title city, where Christians, Muslims, the Palestine Liberation Organization, Israel and Syria - with America and the U.S.S.R. hovering in close range — are engaged in a heavily armed game of cat-and-mouse that has reduced a flourishing urban center to a wary, wrecked battleground.

Loosely based on the abduction of CIA station chief William Buckley by Hezbollah in 1984, “Beirut” never explicitly invokes the name of that then-emerging group. Rather, it plays like a prequel to the grievous events that would engulf the Middle East during that decade and beyond, as political interests and their proxies collided and triangulated with cynical and often tragic results.

With the exception of Skiles, who continues to harbor frayed hope for dealmaking, even though he knows better, very few players in “Beirut” are conventionally sympathetic - including the American Foreign Service lifers who haven’t bothered to learn Arabic while embedding in the region. Their dismissive attitude is summed up in Skiles’s description of Lebanon in an early sequence as a “boardinghouse without a landlord,” where the tenants are “bound only by their shared talent for betrayal.”

Some public-interest groups have already expressed outrage at “Beirut.” Among their complaints: that it was produced in Morocco, in large part because Lebanon has been rebuilt to the point that it can’t credibly pass for a war zone; that it reduces Lebanese and Middle Eastern characters to stereotypes, succumbing to tanks-and-beach-umbrellas cliches that so often capture the contradictions of a sophisticated, cosmopolitan society besieged by sectarian strife and brute violence. Such films as “Waltz with Bashir” and “The Gatekeepers” (and, more recently, “Foxtrot” and “The Insult”) have sought to delve more thoughtfully into the contradictions that animated the civil war, and that still influence the region today. In “Beirut” those forces aren’t the subject as much as a mutable, confounding backdrop for Hamm’s character to redeem himself - and, by extension, the frequently misbegotten policies of the country he represents.

The inherent chauvinism of that premise notwithstanding, “Beirut” is an engaging, well-crafted thriller, offering a showcase not just for Hamm but for Rosamund Pike (playing his levelheaded handler) and an ensemble of terrific character actors, including Dean Norris, Shea Whigham and Larry Pine. Reaching back to John le Carré for its world-weary portrayal of tradecraft, “Beirut” is a crafty drama that doesn’t depend on car crashes or shootouts for its sense of propulsive action. It may be a mostly pessimistic portrait of its time and place, but it offers hope, if only that movies of its style, scope and smarts can still get made.

★★★ (out of ★★★★)

Beirut

When • Opens Friday, April 13.

Where • Area theaters.

Rating • R for strong language, some violence and a brief nude image.

Running time • 109 minutes.