Seven years ago, I heard the name of a prominent Iranian diplomat, Mohammad Javad Zarif, at least 118 times. That was how many days I spent imprisoned in Iran for doing my job as a journalist — and how many days I was beaten by an intelligence officer in the hard-line Revolutionary Guards. He demanded that I falsely confess to being a C.I.A. agent and invent false stories that Mr. Zarif had connections to Western intelligence agencies. Rather than cooperate, I somehow withstood the daily torture.

This month Mr. Zarif, now Iran’s foreign minister, has been in New York for the annual United Nations General Assembly meeting, alongside other Iranian diplomats and President Hassan Rouhani. Together, they have tried to give Iran’s government a humane face as champions of Middle East stability, while denying its human rights abuses.

Theirs is a thankless task: They must know they are lying. Iranian diplomats are caught between their desire to join the modern world and the reality of the government they represent. They also know their own rights are at risk if they don’t follow the wishes of Ayatollah Ali Khamenei, Iran’s supreme leader.

In 2006, when the hard-liner Mahmoud Ahmadinejad was president, one diplomat told me he had one of the world’s most unenviable jobs. I won’t endanger him by naming him, so I’ll call him Amir. He told me: “If you’re a conscientious man who tries to help his country by changing the system from within, you can’t stop feeling suicidal. When you work for this government you can see how corrupt the system is and how erratically the Guards and the judiciary system can behave. And all this happens on the supreme leader’s watch.”