For years after Iran’s 1979 revolution, Iranian journalists working for Western news organizations engaged in a balancing act when reporting from inside the Islamic republic. As Iranian citizens whose passports, language skills and social networks gave them greater access than other journalists had, they also faced harsher consequences if their reporting went too far. But as long as they avoided crossing certain “red lines,” in general they would experience nothing worse than harassment and intimidation. Some portion of the government still cared about Iran’s international image.

That was before June 2009, when Iranians poured into the streets over a disputed presidential election. The government cracked down brutally and blamed the Western press. Arrests followed, and longtime Iranian correspondents melted away, surfacing in North America and Europe with tales of being threatened by their government.

Maziar Bahari, a London-based Canadian-Iranian Newsweek reporter, was in Iran at the time. He was eager to witness an unprecedented moment in his country’s history but decided it was too dangerous to stay after a politician friend was detained. Before Bahari could leave, however, he too was arrested. He was taken from his mother’s house to Evin, the much-feared prison in Tehran’s foothills.

Bahari’s account of his 118-day incarceration, “Then They Came For Me,” turns a lens not only on Iran’s surreal justice system but on the history and culture that helped produce it. Bahari comes from a family of dissidents, including his father and sister, Communist Party members imprisoned under the shah and the mullahs, respectively. He weaves in political and family narratives with accounts of his interrogations, beatings and agonizing nights in solitary confinement.

Bahari’s main contact in Evin was an interrogator, nicknamed “Rosewater” for his cologne, who punctuated physical and psychological abuse with treacly, paternal admonitions. As the book’s primary representative of the regime, Rosewater is embarrassingly unworldly. He accused Bahari of colluding with Western governments to foment revolution in Iran, while also accusing him of attending sex parties where men and women ate chocolate off each other’s bodies in swimming pools.

‘Then They Came for Me: A Family's Story of Love, Captivity, and Survival’ by Maziar Bahari with Aimee Malloy. Random House. 356 pp. $27. (Random House)

“He reminded me of kids from traditional backgrounds in my high schools who’d thought that people in north Tehran, families who led more Westernized lives, acted out pornographic movies daily,” Bahari writes. “He hated me for being able to enjoy on earth things that were, for him, reserved only for a time after death.”

Bahari’s book is a damning account of a nation run by paranoid, sexually frustrated conspiracy theorists. The more Bahari insisted that he was not a foreign agent and had not slept with all the females on his Facebook friend list, the more savagely he was beaten and threatened with worse. Eventually he made false confessions: a chilling one, for state television, where he admitted to conspiring with foreign governments; and a hilariously satisfying one, in the privacy of the interrogation room, where he concocted tales of receiving erotic massages as Rosewater breathed heavily and asked for more.

A campaign of international pressure took shape on Bahari’s behalf, and he was ultimately released after he promised to spy for Iran. As soon as he landed in England (days before the birth of his daughter), he hurled an expletive at his jailers in an e-mail reneging on the promise. He has since been sentenced in absentia to 13 years in prison and 74 lashes, and he seems unlikely to return while this regime remains in power. And so, after 12 years of filing carefully edited reports, and in spite of threats from his former captors that they can get to him abroad, he has stopped holding back, and he indicates that many inside Iran have, too.

“People overwhelmingly blame [Ayatollah Ali] Khamenei for the rapes, tortures, and murders” that took place in prisons after the election, he writes, referring to the country’s supreme leader, who was once considered off-limits to criticism. “Khamenei recognizes that the gap between the people and his government is widening. But rather than looking for a long-term solution or listening to his people, he is trying to narrow that gap through brute force. The supreme leader is becoming ever more isolated and deluded about his own powers.” In an open letter to Khamenei published in a newspaper, Bahari spoke bluntly, “I think you are responsible for what happened to me.”

The delicate balance between truth and censorship has been destroyed. Iranian journalists no longer write from Iran for international news organizations under the tacit rules that worked for both sides for so long. In arresting Bahari and driving others like him out of the country, Iran has lost the voices that once helped explain it to the world. Instead, those voices have begun to cry out against it in anger.

Tara Bahrampour is a Washington Post staff writer and the author of “To See and See Again: A Life in Iran and America.”