The punishing ordeal of Iranian journalist Maziar Bahari — imprisoned for 118 days on charges of espionage — is brought to the screen with impressive tact and intelligence by writer-director Jon Stewart in “Rosewater,” an alternately somber and darkly funny drama that may occupy the same geographic terrain as “Argo” (to which it will inevitably be compared), but in most other respects could hardly be more different. Largely a two-hander between Bahari (played by Gael Garcia Bernal) and the interrogator who puts him through a gauntlet of soul-crushing mindgames, Stewart’s confident, superbly acted debut feature works as both a stirring account of human endurance and a topical reminder of the risks faced by journalists in pursuit of the truth, minus the caper antics and flag waving of Ben Affleck’s populist Oscar winner. Strong reviews and smart, targeted marketing should help this Nov. 7 Open Road release find its niche with politically savvy adult moviegoers, and perhaps a dark-horse position in the awards-season derby.

Stewart (whose prior screen credits consist of supporting roles in a string of forgettable ’90s comedies) may seem like a left-field choice to adapt Bahari’s 2011 memoir, “Then They Came for Me.” But in one of the story’s several stranger-than-fiction twists, an appearance by Bahari on “The Daily Show” ended up being used by his jailers as evidence of treason. (In the obviously satirical segment, Bahari was among those interviewed by Stewart cohort Jason Jones as he blundered his way through Iran pretending to be an American spy.) That was in 2009, during the run-up to the Iranian presidential election that pitted incumbent Mahmoud Ahmadinejad against reform-minded opposition candidate Mir-Hossein Mousavi. Bahari, an Iranian national living in London with his pregnant wife (Claire Foy), had returned to Tehran to cover the elections for Newsweek.

Stewart gets things off to a suitably nerve-jangling start with Bahari’s arrest nine days after the election, plucked from the home of his elderly mother (Shohreh Aghdashloo) by agents who accuse him of possessing “pornography” such as DVDs of Pasolini’s “Teorema” and “The Sopranos.” The movie then loops back to Bahari’s arrival in Iran two weeks earlier and spends most of the next half-hour depicting his activities in the days leading up to and following the election, as he interviews supporters from both candidates’ camps; visits a rooftop festooned with illegal satellite dishes (bringing uncensored news from across the borders); and eventually documents the post-election rioting that erupts when Ahmadinejad is declared the landslide victor in heavily contested results. It’s a bittersweet homecoming for Bahari, whose late sister had spent six years in a state prison on charges of being a communist, and whose father had been similarly imprisoned in the ’50s by the Shah. But as the journalist goes about his professional duties, he little suspects that all this will soon come back — literally and figuratively — to haunt him.

Stewart and cinematographer Bobby Bukowski favor a simple, direct, pseudo-verite shooting style (think of a less jittery Paul Greengrass) that gives these early scenes a street-level immediacy, enhanced by bits of real news footage (including a televised debate in which Ahmadinejad makes outrageous claims against Mousavi’s wife) and vivid location work in Jordan, which doubles convincingly for Tehran. In other respects, Stewart’s film is an explicit work of dramatization, with a Mexican leading man fronting an all-English-speaking international cast. But rather than seeming like concessions to the commercial marketplace, those choices serve to underscore the universality of Bahari’s story, versions of which are playing out all over the world even as “Rosewater” is playing out onscreen. (Since his release, the real Bahari has become an active campaigner for the release of jailed journalists in Iran and elsewhere.)

That feeling only intensifies in the film’s second half, as Bahari serves out his time at the notorious Evin Prison, a nondescript, gray-walled bunker where news of the outside world rarely intrudes. At this point, Stewart’s film works to mirror Bahari’s own deprivation; it cuts us off from the outside world, too, the camera rarely venturing anywhere Bahari himself can’t, until we become keenly aware of how such confinement can wear down a person’s sense of hope. It’s here that Bahari is paired with the “specialist” (Kim Bodnia) he eventually nicknames Rosewater (after the man’s familiar scent), a skilled practitioner in the art of psychological torture who accuses Bahari of being an agent in the employ of the CIA, MI6 and/or Mossad, and assails him with questions that range from the rhetorical (“How many Jews work at Newsweek?”) to the random (“Why have you visited New Jersey?”) to the absurd (“Who is Anton Chekhov?”). Yet his methods, while cruel and certainly unusual, can seem mild compared with the “tough interrogations” of Guantanamo Bay and Abu Ghraib — a connection Stewart’s film never explicitly makes, but which is hardly lost on it.

There is something of Polanski in the movie’s intentionally claustrophobic tension, and a tone held in careful balance between despair and gallows humor. As in his book, Bahari sinks deeper and deeper into the recesses of his own mind, imagining himself to be in deep conversation with the spirits of his sister (Golshifteh Farahani) and father (Haluk Bilginer) and, in one of the film’s most memorable scenes, swaying to the half-remembered sounds of Leonard Cohen singing “Dance Me to the End of Love.” Such moments might easily have seemed arch, melodramatic or theatrical, but Stewart never overplays his hand. Neither does Bernal, who gives us a Bahari brimming with quiet outrage, growing doubts about his own sanity, and the eventual realization that the only way to secure his freedom is to play by his captors’ skewed set of rules.

The Cohen song proves apropos in that Bahari and Rosewater’s relationship is certainly a dance and, while nobody’s idea of a romance, a kind of no-exit codependency. And just as the film refuses to turn Bahari into a self-pitying victim, so, too, does it avoid making Rosewater a one-dimensional sadist. Rather, like so many oppressors throughout history, he is the product of a corrupt system, a talented man serving an ignoble goal, his own ideologies — whatever they once may have been — long ago corroded by institutional thinking. And now, that very system may be collapsing right under him. The gruff, Danish-born Bodnia, who made a big impression two decades ago as the angry young male lead of Nicolas Winding Refn’s “Pusher” and “Bleeder,” has only gained in steely presence with the onset of middle age, and the brilliance of his performance is that he humanizes Rosewater without ever dulling his threat. Indeed, he is all the more terrifying precisely because we can imagine him going home at night to his wife and kids.

Though we know going in that Bahari will live to tell his tale, Stewart maintains a serenely unsettling tension throughout. Perhaps more impressively, he’s made a movie of the moment that doesn’t feel like a sententious “issue” drama, and is all the more affecting for it. Through Bahari’s eyes, and with utmost respect for the Iranian people, “Rosewater” gazes out at a nation flirting perilously with a new era of social liberties, and finds glimmers of hope in the darkness.