Nazila Fathi, a former New York Times reporter in Tehran for more than a decade, is the author of “The Lonely War: One Woman’s Account of the Struggle for Modern Iran.”

In January 2009, the Nobel Peace Prize laureate Shirin Ebadi was in her Tehran office when she heard her name. “Death to the traitor Ebadi,” angry men were shouting outside. Immediately, she locked the doors of the building and fled upstairs to her apartment, where her husband, Javad Tavassolian, was standing by the window, watching a mob carrying sticks and banners on the street. With trembling hands, she dialed the local police. “I think they’re here to kill me,” she heard herself say — finally uttering the words she had avoided since she began her activism in the 1990s. She knew why many in Iran reviled her. For more than two decades, she had criticized the country’s discriminatory laws and defended the most controversial political prisoners pro bono.

In “Until We Are Free,” Ebadi recounts the cycle of sinister assaults she faced after she won the Nobel Prize in 2003. Her new memoir, written as a novel-like narrative, captures the precariousness of her situation and her determination to “stand firm.”

The 1979 Islamic revolution stripped Ebadi of her judgeship when the new authorities banned women from holding the position, forcing her to stay home and raise her two daughters. A decade later, she opened a law firm and became vocal against the country’s statutes that discriminate against women and others. One blatant example is a law that puts the value of a woman’s life or a non-Muslim’s life at half that of a Muslim man’s life. When an 11-year-old girl named Leila was raped and murdered by three men, a court ruled that her parents had to pay a substantial amount to have the men executed or they would be released, because their lives were worth more than Leila’s. Ebadi took the case and threw a national spotlight on the state of criminal law in Iran.

The 2003 Nobel Prize elevated her status but didn’t stop the regime from going after her even more ruthlessly after the election of President Mahmoud Ahmadinejad in 2005. Government spies followed her, harassed her colleagues and even nailed death threats to her door.

To intimidate her, two intelligence officers disguised as tax agents barged into Ebadi’s office, demanding to search the place. The local police, whom she contacted again for assistance, watched helplessly as the two men carried away clients’ files just a few weeks before the mob attack.

Then the authorities targeted her daughter when she arrived for a visit from Canada, where she was pursuing a master’s degree. They detained her briefly and took away her passport without indicating when it would be returned. Knowing that their phones and emails were monitored, Ebadi and her daughter pretended in conversations with friends that the student was enjoying her time back home. “If they concluded that she was my weakness,” Ebadi writes, “there would be no telling what they might do to her next, or to me.” Ebadi’s unwillingness to negotiate with the authorities over her daughter’s passport, she presumes, led them to return it.

In June 2009, Ebadi was in Europe when a massive uprising over allegedly rigged presidential elections rocked Iran and made international headlines. The government violently confronted the protesters, opening fire on scores of people, jailing thousands and torturing countless others. Ebadi used her position outside the country to denounce the government’s actions and turned herself into a more formidable foe of the regime.

“I wasn’t really frightened of going to prison,” she recalls, explaining why she decided to stay abroad. “I knew it would be politically too costly for the state to keep a Nobel laureate imprisoned for too long and I’d be released after a spell. But the intelligence agents were far too clever for that. They would arrange, as they had done in the past, for a mob to attack my house, and I would be killed in the melee.”

Ebadi then confronted government efforts to silence her in exile. That summer, her husband of 35 years disappeared for a few weeks in Tehran. When he finally called, he offered a shocking revelation. The authorities had walked in on him with video cameras while he was having sex with a woman who was once his mistress. In Islamic Iran, sex outside of marriage is an unforgivable sin; the authorities let the woman go but took Tavassolian to prison, where they gave him a lashing on his bare back. A court swiftly convicted him of adultery and sentenced him to death by stoning.

With execution hanging over him, and subjected to daily physical and psychological torture, Tavassolian was presented with a proposition. He told Ebadi over the phone that his intelligence handler promised him his freedom in return for his passport and the deeds to all the properties the family owned. “Javad was now crying openly, stopping every few seconds to draw a breath before continuing,” Ebadi writes. Knowing that the security agents had used the former mistress to set him up, Ebadi laments: “I wanted to run out on to the balcony and scream. How much could they take away from one person?”

Ebadi weaves a range of political events into the narrative, including the uprising and civil war in Syria, and describes many of the human rights cases she defended. But it is her personal story that is most compelling. After the authorities sold her properties, including the office of a center she had set up for colleagues to defend human rights cases, they contacted her with an offer: If she stopped her activism, they might let her reopen the center in Tehran. “What I support is the people, and their rights as citizens,” she told them. “If I am to be silent and not defend my people, why would I need an office?”

And so the harassment of her family continued. Her sister was jailed for several weeks, and Tavassolian was continuously interrogated. In the seven years that Tavassolian was separated from his family, he received his passport only once for three weeks to visit his wife and daughters. Even then, he had to carry a pen with a GPS device installed so the authorities knew his whereabouts at all times. If he refused to return, they warned him, his Tehran apartment would be confiscated. Finally, Tavassolian and Ebadi agreed to divorce, hoping that perhaps he could resume a life without harassment because of his association with her.

The book ends with a kind of eulogy to the marriage Ebadi lost. “Even if we learned to trust each other again and were able to forgive,” she writes, it couldn’t happen “if we were never able to see each other.”