Passengers embark on a superstitious journey with a goldfish in Jafar Panahi’s generous film, “Taxi,” which has the director as a cabdriver picking up a variety of people in Tehran. (Kino Lorber)

In the five years since Iran forbade him from practicing his art, filmmaker Jafar Panahi has managed to make three features. For the latest, the comic gem "Taxi," he adopts a playful mood and the guise of a cabdriver tooling through the streets of Tehran. It's an act of defiance that's also a sublime piece of cinema, and it ranks among the director's finest work.

Officially deemed an anti-regime propagandist, Panahi has been barred from filmmaking, political activity, traveling abroad and giving interviews — most of which he accomplishes, to varying degrees, in "Taxi." Despite its breezy surface, the film is no less fueled by outrage than Panahi's two other recent works, both made under the constraints of house arrest. But unlike "This Is Not a Film" and "Closed Curtain," Panahi's new movie, which received the top prize at the Berlin festival, exudes an outward-looking generosity.

Wearing a cap, glasses and a genial smile, Panahi the cabdriver embarks on encounters with a range of characters. Within the enclosed but permeable capsule of his car — an apt metaphor for his situation — a roadshow microcosm of Iranian society unfolds. Most of the action is captured with a dash-mounted camera, but it's only one of several lenses in a feature where films-within-the-film multiply.

In a metafiction tradition specific to Iranian cinema, a hybrid of documentary and narrative that Panahi helped to germinate, the staged and the spontaneous intermingle. They're often indistinguishable, and the effect is tantalizing. It seems that many of Panahi's passengers are playing versions of themselves, but he pointedly omits end credits, noting that the approval of such information would fall to the Ministry of Culture and Islamic Guidance. (The ministry has OKd only one of his films, "The White Balloon," for distribution in Iran.)

"Taxi" opens with an argument over capital punishment between a progressive female teacher and a condescending loudmouth who's all macho swagger. The theme of crime and punishment, with an emphasis on compassion, threads through this road movie, culminating in a conversation with a human-rights attorney whose equanimity in the face of daunting challenges mirrors Panahi's.

Jolts of comedy are tinged with slapstick: Two older women flag down the cab for an urgently superstitious mission involving goldfish; an injured motorcyclist and his melodramatically wailing wife enlist another passenger's help in recording a verbal will.

As much as it is a kaleidoscopic portrait of Iran, "Taxi" is a love letter to movies. Beyond Panahi's references to his own films, both winking and direct, he includes shout-outs to his international brethren, Nuri Bilge Ceylan and Woody Allen among them. In a key encounter, movie bootlegger Omid is delighted to recognize the moonlighting famous director. Omid insists that his trade is a "cultural activity," and he has a point: In a country whose rulers suppress art, the heavy bag of DVDs he carts around contains, in essence, the world.

And then there's Panahi's tween niece, a precocious budding filmmaker played by the director's real-life niece, Hana Saeidi (who tearfully accepted Berlin's Golden Bear award on his behalf). Armed with a list of the qualities that make a film distributable in Iran — ixnay on the "sordid realism," for starters — she tries mightily to turn a petty thief into the hero of her work-in-progress.

One of the running jokes in "Taxi" is that everyone's a filmmaker. Given Panahi's circumstances, it's a bitter joke, to be sure. But his quiet indignation is, remarkably, matched by joyful gratitude. "All movies are worth watching," he tells a film student who puts on highbrow airs for his benefit. In another joke coursing through the film, Panahi is a lousy cabbie, his sense of direction shaky at best. But though this important artist has been forced down furtive paths, his aim has never been truer.