In the films of Iranian writer-director Asghar Farhadi, every person lives inside a web of relationships. Every relationship has the potential for misunderstanding. Every misunderstanding has the potential for calamity.

So it goes with “A Hero,” in which a good man trying to do a good thing (if not for the best reasons) gets mired in an escalating series of controversies and squabbles. The more he tries to extricate himself, the deeper he gets. “A Hero” is now playing on Amazon Prime.

Rahim (Amir Jadidi) is first shown with a smile on his face, unusually cheerful for a man who is in debtor’s prison for a large sum of money he owes to his brother-in-law (Mohsen Tanabandeh). But Rahim, out of jail on a two-day furlough, has a plan. His girlfriend (Sahar Goldust) found a handbag full of gold coins at a bus stop, and Rahim wants to sell them and pay off his debt.

Only the exchange rate isn’t very favorable, so Rahim decides to return the coins to their rightful owner. For this selfless act, Rahim becomes something of a folk hero in the Iranian city of Shiraz, and prison officials think the deed might be good PR for them. But, of course, he’s not entirely altruistic. If he could have gotten more money for the coins, he would have sold them in the first place.

It’s on little ambiguities like that that “A Hero” turns. As news of Rahim’s deed goes viral, he’s not shy about using the positive attention to aid him, including involving a charity to raise money on his behalf. But then, as always seems to happen with such stories, the tide turns against him, as people poke holes in his inspiring narrative. Jadidi masterfully shows Rahim’s growing frustration and desperation as the inconsistencies mount, and the narrative spins out of control.

Farhadi parcels out the information in this story in small portions, adding new details and context that make us look at characters in a different light. There are elements of a thriller here as Rahim tries to work his way out of one predicament only to become mired in another. But unlike a noir thriller, there are no heroes or villains, just ordinary people whose interests sometimes align and sometimes clash.

For no one is this more true than Bahram, his creditor and ex-brother-in-law. At first, he seems like the villain of the story, refusing to cut the good-hearted Rahim a break on his debt. But as we learn more about Bahram, we see how he’s also suffered from putting his trust (and his money) in Rahim.

“A Hero” isn’t quite as powerful as Farhadi’s best films, including the Oscar-winning “A Separation” and “About Elly,” but it also relies less on plot contrivances than his last film, “Everybody Knows.” Instead, it’s a solid drama that keeps revealing new facets as it progresses.

Share your opinion on this topic by sending a letter to the editor to tctvoice@madison.com. Include your full name, hometown and phone number. Your name and town will be published. The phone number is for verification purposes only. Please keep your letter to 250 words or less.