During a 2009 Daily Show interview with Maziar Bahari, the Canadian-Iranian journalist who, earlier that year, had been imprisoned in Iran for 118 days on espionage charges, Jon Stewart said, “We hear a lot about the banality of evil, but so little about the stupidity of evil.” Or about its total humorlessness.

Bahari had been arrested the previous June partly as the result of a Daily Show skit: Comedian Jason Jones, posing as the most phony-baloney spy imaginable, wearing a keffiyeh and dark glasses, interviewed Bahari in a Tehran cafe just before a fraught and ultimately explosive election. “Why is Iran so evil?” Jones demanded. The perfect straight man, Bahari gave a response that was deflective, sensitive and articulate. That didn't stop Iranian authorities from arresting him shortly after the election, four days after the episode aired, using The Daily Show as proof that Bahari was a spy.

Perhaps partly out of a sense of guilt, although probably mostly because he knows an astonishing story when he sees one, Stewart has made a movie — his debut as a director — based on Bahari's experience. Rosewater is an earnest picture, but it's also got some juice — there's vitality and feeling in it, the secret ingredients so often missing from even the most well-intentioned first features.

At the beginning of Rosewater, Gael García Bernal's Bahari leaves his London home and pregnant wife for what he thinks will be a routine visit to his hometown, Tehran, to cover the election for Newsweek.

He hires a hip young driver, Davood (Dimitri Leonidas), who doesn't actually have a car — just a shaky little motorbike. But Davood knows all the right people, and through him Bahari meets a group of idealistic young men who have educated themselves by tapping forbidden TV channels via a wholly illegal garden of satellite dishes perched on a rooftop. (They call this makeshift institute of higher learning “Dish University.”)

These guys make it clear they'll be casting their vote for Mousavi, the challenger to the controversial, bellicose incumbent Ahmadinejad. To them, and to Bahari, it seems perfectly plausible, if not likely, that Mousavi could win a democratic election — provided the election in question is going to be at all democratic.

Meanwhile, Bahari meets with Jones (playing himself) and gives what he assumes is a harmless interview — between takes, he cracks up at the ridiculous obviousness of Jones' spy shtick.

A few days later, it's not so funny: The election results spark violence, some of which Bahari captures on camera. He at first assumes that's the reason he's picked up by government goons, as his mother, played with authoritative gravity by Shohreh Aghdashloo, anxiously looks on. No wonder she's worried: Bahari's father and sister both spent time in prison, during the eras of the shah and Ayatollah Khomeini, respectively.

Still, Bahari can't believe he'll be held for long, until he realizes that his interrogator, a man known to him only as Rosewater (played by Kim Bodnia), genuinely believes that Newsweek is a spy organization. Bahari is routinely quizzed and beaten. His refusal to cooperate — because how, exactly, is he supposed to respond to these idiots? — lands him in solitary confinement. At one point, he's led to believe that he's going to be killed.

We all know Stewart is a smart guy who's good at talking. What's surprising is how good he is at filmmaking. Stewart — who also adapted the script, from Bahari's 2011 book, Then They Came for Me — understands that even a story relying largely on dialogue, as this one does, also needs to be cinematic. As Bahari, pre-arrest, walks down a Tehran street, he thinks of his father and sister, both now dead: Bernal recounts their stories in voice-over, and we see their images hazily reflected in the storefront windows he passes, ghosts brought vividly to life.

In another sequence, Bernal's Bahari performs an expressive solo ballet to Leonard Cohen's “Dance Me to the End of Love” — a song, and an artist, his sister had turned him on to — in his lonely, underfurnished cell. The music, of course, is playing only in his head, but his power to conjure it is key to his survival. The sight of Bernal leaping, twirling and kicking to the sound of nothing — which is really the sound of everything — is the movie's glorious visual centerpiece.

Bernal gives a thoughtful, delicately calibrated performance, and he's funny, too: At the movie's high point, Bahari outwits his pedantic interrogator in a way that's pure comedy, so outlandish that you can't believe it could actually work. But then, Bahari's captors, blindly devoted to the religious supremacy of the state, aren't terribly good at thinking for themselves. And it's in setting the movie's tone, layer by layer, that Stewart proves most adept.

Bahari's tormentor, endeavoring to get the prisoner to “confess,” sticks to his dumbest ideas with the tenaciousness of an octopus' sucker. He cites items seized upon Bahari's arrest — they include a DVD copy of Pasolini's Teorema, which the authorities have deemed “porno,” as well as a Cohen album and a Tintin book — as evidence of the journalist's lack of moral steadfastness. At one point, the grand inquisitor asks Bahari, in all seriousness, about his affiliation with an individual named Anton Chekhov, whom Bahari has quoted admiringly on his Facebook page.

Rosewater isn't one of those nicey-nice vehicles that takes pains to remind us that some people are just culturally “different” and thus can't be held responsible for adhering to warped religious and political dogma. Instead, Stewart puts it pretty plainly: Some people are just idiots, and the stupidity of evil can kill you. Thank God Bahari managed to outsmart it.

ROSEWATER | Written and directed by Jon Stewart | Open Road Films | Citywide

Advertising disclosure: We may receive compensation for some of the links in our stories. Thank you for supporting LA Weekly and our advertisers.