Legal disputes
A Hero was inspired by the story of Mohammad Reza Shokri, a man who returned a bag of cash he found while on a leave from a debtors' prison in Shiraz, although Farhadi has stated in interviews that it "was not inspired by a specific news item". Azadeh Masihzadeh made a documentary about Shokri from 2014 to 2015, when she attended a workshop taught by Farhadi on documentary filmmaking at the Karnameh Institute in Tehran. In the course, Farhadi assigned his students to research and film a documentary about people who had found and returned valuable objects to their original owners. According to Masihzadeh, while most students in the class took subjects from a list of excerpts from news media Farhadi provided them with, she decided to work in her hometown of Shiraz to save expenses, and an acquaintance told her that she saw a news story about Shokri on local television. Masihzadeh then went to a local newspaper and the TV station that aired the news, obtained permission to film in prison, and met Shokri. Farhadi saw rushes and gave her notes at five sessions over six months. Five projects in the workshop, including Masihzadeh's, were to be consolidated into one film, with Farhadi's involvement obscured so as not to raise too much expectation. Masihzadeh obtained permission from Farhadi to screen her film by itself. Under the title All Winners, All Losers, the film screened at the Shiraz Arts Festival in 2018, where it won the Special Jury Prize. Later, Masihzadeh was told that the collective film had finally been completed and that her segment would not be included if she continued screening her film. With the understanding that Farhadi's name would appear in the credits, she agreed to withdraw her film from festivals.
In August 2019, when Masihzadeh was enrolled in a screenwriting workshop by Farhadi at the Bamdad Institute in Tehran, Farhadi asked Masihzadeh to sign a document stating that the idea for All Winners, All Losers belonged to Farhadi. In the presence of Parisa Bakhtavar, his wife and director of the institute, and secretary Farideh Shafiei, Masihzadeh obliged, which she later said she did under pressure. A lawyer for Memento Films, the French producer and distributor of A Hero, later pointed out that the document had no legal value as "ideas and concepts are not protected by copyright".
In late 2020, Masihzadeh learned that Farhadi was making a film in Shiraz, and tried, in vain, to contact him in the city. After learning the plot of A Hero when it was announced to be in Cannes competition, Masihzadeh sent five people to watch the film at Cannes and report back. She estimated a 70% resemblance based on their report and began posting similarities they spotted on Instagram under the hashtag #a_hero.
In September 2021, Masihzadeh's lawyer sent Farhadi a message stating that her intellectual property rights had been violated and requesting "dialogue and negotiation". A month later, a meeting was held at the House of Cinema, where Farhadi's lawyer told Masihzadeh that she had committed the crime of defamation and that a complaint would be filed against her if she did not delete her Instagram posts. Another meeting took place two days later, this time with Farhadi in attendance, and he accused Masihzadeh of lying and being ungrateful. Farhadi offered to mention her in the end credits as a researcher and pay her roughly $1,600, while she requested that opening credits state A Hero was based on her film and that she share in the film's revenue. The House of Cinema's arbitration council issued a decision concluding that Masihzadeh's claim was false.
In early November 2021, Farhadi filed a criminal complaint with the Tehran Culture and Media Court, accusing Masihzadeh of defamation and spreading misinformation. On November 30, 2021, Masihzadeh filed a counterclaim, accusing Farhadi of plagiarism, intellectual property theft, and "illegitimate gains by fraud or abuse of privilege". In January 2022, Farhadi filed another complaint accusing Masihzadeh of defamation and misinformation, in regard to her claim that she was coerced to sign a statement. Masihzadeh claimed that she discovered the story herself and that it had not been reported in national media at the time, while Farhadi's lawyer argued that the story had already been reported in media. The manager of the workshop told media that she shares Masihzadeh's recollection. A fellow student who attended the workshop also testified in support of Masihzadeh in court, while some other students signed a statement in support of Farhadi denying the allegation. Masihzadeh faced up to one year in prison or 74 lashes, though corporal punishment is rare for first offenders and the prison time may be avoided by paying fines.
Masihzadeh found 56 similarities between her film and A Hero, 49 of which had not been reported in the press, such as the original owner of the money discovering the notice at a bank, her husband's unawareness of the loss of the money, and prison staff's improved treatment of Shokri after he returned the money.
In March 2022, the magistrate for the case issued an opinion finding merit in Masihzadeh's claims, and indicted Farhadi and referred the case to a criminal court, while dismissing Farhadi's complaints and Masizadeh's claim to revenue. On 4 April 2022, The Hollywood Reporter erroneously reported that Farhadi had been convicted, which he could not appeal, only to issue a correction stating that he had been merely indicted and that the case would now move to a second judge, whose ruling may still be appealed. Farhadi denied the charges in the criminal proceedings. On 13 March 2024, a court issued a verdict acquitting Farhadi of the plagiarism charges, based on the opinion of a panel consisting of three University of Tehran professors specialising in copyright law and four official art experts, which stated that the events depicted in the documentary had been widely reported in media and belonged to the public domain.
In November 2021, Masihzadeh met Shokri in prison in Shiraz and, with permission, took him to a screening of A Hero, which she had bought out. Shokri saw the film in shackles and handcuffed. He was particularly offended by the film's inclusion of the protagonist's son with stuttering, as he had a brother who had difficulty speaking, who had died after the making of the documentary and whom Shokri had asked Masihzadeh not to film so as not to arouse pity. Shokri filed a complaint against Farhadi for defamation and revelation of personal information, among other charges, stating that he had granted Masihzadeh an exclusive permission to depict his story. The magistrate dismissed the complaint.