Jon Stewart’s temporary break from his “Daily Show” gig has resulted in a solid, committed but cinematically not terribly imaginative film about the incarceration and interrogation of Newsweek reporter Maziar Bahari in his native Iran in 2009, purportedly on charges of spying. Anchored by a strong performance from Gael Garcia Bernal, “Rosewater” obviously represents a labor of love for the faux newsman-turned-filmmaker, and emerges as a sober, thoughtful addition to the corpus of serious pictures about those unjustly imprisoned under oppressive regimes.

It was, in fact, Bahari’s appearance on Stewart’s show that got him into trouble in Iran. During a visit to the country to cover the presidential election in 2009, he agreed to appear in a sketch with Jason Jones, one of the ersatz correspondents on “The Daily Show,” who actually went to Tehran to film some typically buffoonish footage. Jones pretended to be an American spy and asked Bahari some typically inane questions, to which the Iranian offered serious answers. But Iranian authorities caught wind of the episode and took it to suggest that the reporter was actually taking to an espionage agent. They picked him up at the home of his mother (Shohreh Aghdashloo), where he was staying, and took him in for extended questioning by a “specialist” (Kim Bodnia), who was under pressure from his boss to secure a quick confession (and whom Barahi’s dubbed Rosewater after a scent from his childhood that the man led him to recall). It didn’t help that he had also been consorting with some supporters of the anti-establishment candidate, and had photographed protest demonstrations that had broken out after the dubious results announced that Mahmoud Ahmadinejad had won in a landslide against reformist Mir-Hossein Mousavi .

In any event the government “specialist” didn’t get the fast, easy confession he wanted. Barahi’s ordeal dragged on for more than a hundred days, during which he was subjected to some physical but more psychological torture. Stewart, Bernal and Bodnia portray the grueling business in mostly straightforward, purely realistic style, and do so with admirable directness. They are able to bring some moments of dark levity into the interrogation sequences, particularly in the later stages, when Bahari takes advantage of his questioner’s prurient interest in non-Iranian lifestyles to divert his attention with ludicrous false admissions. And a hint of magic realism comes to the fore in hazily remembered flashbacks and sequences in which the spirits of Barahi’s stronger-willed father and sister (Haluk Bilginer and Golshifteh Farahani)—both victims of oppressive Iranian regimes going back to the Shah—appear to him to encourage him to remain steadfast. And there are moments, such as an impromptu dance that Bahari does to music in his head, that show his resilience in the midst of his solitary confinement, during which no report of the groundswell of support in the West demanding his release—partially orchestrated by his wife (Claire Foy), who was pregnant when he left for Iran—was kept hidden from him and he was instead informed that he had been abandoned by everybody.

Bernal plays all of this with the intelligence and emotional resonance one has come to expect of him, and it’s characteristic of his—and the film’s—honesty that Bahari doesn’t emerge here as a plaster saint, but as a man riddled with self-doubt and willing to compromise, at least to some extent, to satisfy his captors and win his release. Nor is Rosewater treated as merely a stock villain. As portrayed by Bodnia, he’s depicted as a man under pressure too, although of a less cruel sort, and as a figure blinded by devotion to a regime that relies on terror in order to preserve its ideological basis untainted—as well as a man in a country so shut off from external influences (a fact emphasized by the dissidents’ desire to accumulate as many satellite dishes as possible) that his knowledge of the outside world is almost childlike in its naivete. The rest of the cast offer strong support, with the sad-faced Aghdashloo certainly standing out as a woman beaten down by the repeated losses her family has suffered.

For the most part Stewart and cinematographer Bobby Bukowski emphasize the claustrophobic nature of Bahari’s confinement in Evin Prison, keeping the images close-in while carefully positioning the camera to maintain the captive’s predicament of being cut off completely by the dank, barren walls. But in the exteriors that occur primarily in the first act, before the arrest, they make good use of Jordanian locations to create a real sense of place, even though it’s not actually Tehran. Occasional insertion of contemporary news footage adds to the feeling of authenticity, and the contributions of editor Jay Rabinowitz and composer Howard Shore add to the picture’s immediacy.

There’s a sense of relief at the end of “Rosewater,” when Bahari is released. But any sense of triumph is accompanied by the realization that many remain imprisoned and oppressed in Iran. (Scenes of him leaving many of the Mousavi supporters he met before being arrested now languishing in prison themselves, as well as bittersweet reunion with his mother, are important in that respect.) Stewart hasn’t made a contemporary version of “The Shawshank Redemption”—his is a tough, gritty portrayal of the trials of a single man brutalized by a system that continues to mistreat many more. It won’t bring about the change one hopes for in Iran, of course, but if it contributes to public awareness of the realities there, it will have served a useful function. And, of course, it’s a great personal story, well told.