In the early months of 2024, a few weeks into the shooting of his new film, “The Seed of the Sacred Fig,” Mohammad Rasoulof learned that his lawyers received a letter. Iran’s Islamic Revolutionary Court had processed his case, composed of several charges against his previous movies and activism, and sentenced him to eight years in prison. Rasoulof asked his lawyers how much time he had before the authorities took him in. The process of filing an appeal, they told him, could take up to two months. He still had some time.

Rasoulof and his team worked around the clock on shooting and postproduction. Another call came in. The court had rejected the appeal, and his eight-year sentence was to start immediately. To make an example of him, his lawyers warned, government agents would probably storm his house in the middle of the night, handcuff him and take him to jail.

Rasoulof had to make the most difficult decision of his life. He was always determined to live and work in Iran, which had been a wellspring of inspiration throughout his filmmaking career. He had already been arrested in 2010 for shooting a movie about the Green Movement, a period of mass unrest in the wake of the 2009 presidential election, which he never finished. He was sent to jail for seven months in 2022 after signing a petition that was critical of the government. So he didn’t fear being in prison, and he felt no urge to flee from regime interrogators and torturers. If anything, those encounters had provided fodder for his work. Yet this time was different. Already confronted with the likelihood that he would have to serve at least five years of his eight-year sentence, Rasoulof expected that the court would probably open a new case once it learned about “Sacred Fig,” which he was shooting in secret, without the appropriate approvals. Serving five years, plus whatever the latest charges would yield, would surely end his career. So Rasoulof decided to leave Iran.

He had learned, from another inmate during one of his prison stints, about a network of people who specialized in helping persecuted citizens escape Iran. When Rasoulof contacted them, they advised him to leave everything behind, including his electronic devices and IDs, throw some clothes in a backpack and meet them in a town near Tehran.

Rasoulof was taken to a hiding place and, from there, driven on a side road to another city. After a few days of traveling along abandoned roads, he reached a small village on the border. He stayed in a small room for a few days, preparing for the final leg of his journey, which involved a hike over the mountains into a neighboring country. The villagers, who had met many people in his circumstances, suspected he was important because the network regularly checked in about his well-being. For the villagers, harboring such an escapee entailed more risk, which meant more pay. When it was time for Rasoulof to depart, they refused to release him.

Astonished by this turn of events, members of the network negotiated a deal with the villagers. At midnight, he was delivered to a spot in the middle of nowhere. It was so dark he couldn’t see anything. Money changed hands, and he was returned to the people he hired to smuggle him out of the country. They then took him to another border village, from which the passage to the neighboring country was longer and more treacherous.