The first thing I noticed about Shahab Shahamifar as we strolled to synagogue on a Saturday morning in July was his yarmulke. It was a medium-size, black knitted one, and he was wearing it as we walked the busy streets of Tehran.

Then I noticed that no one looked up.

Later, when the rabbi went on a bit too long with a sermon on the week’s haftara portion, I left services early, and Shahamifar rushed out to accompany me the first block or so before returning to pray. This time, in addition to his yarmulke he wore a long tallit, a prayer shawl, also with no sense of self-consciousness.

Image by Larry Cohler-Esses Dr. Siamak Moreh Sedgh, the Jewish community’s elected representative in Iran’s parliament

Saturday is a workday in Iran’s capital, and women in chadors and men in business suits hurried by us without so much as a glance. Moreover, the night before, when several hundred worshippers gathered for Friday night services at the Yousef Abad Synagogue in North Tehran, I noticed, too, that the sanctuary’s large entrance remained open to the street as people spilled out for breaks to shmooze in crowds on the sidewalk outside. No security of any kind was in sight.

“Compared to Europe,” boasted Dr. Siamak Moreh Sedgh, the Jewish community’s elected representative in Iran’s parliament, “synagogues here are one of the safest places.” He also said proudly, “We have a high rate of people following Halacha,” or traditional Jewish law, “and a low rate of assimilation. The rate of intermarriage among Iranian Jews is less than 1%.”

Of course, there are a lot fewer Jews now than before Iran’s 1979 Revolution.

Image by Larry Cohler-Esses Homayon Najafabadi, the Executive Director of Tehran Jewish Committee

Homayoun Sameyah Najafabadi, the current chair of the Tehran Jewish Committee, Iranian Jewry’s central body, told me there were just 9,000 Jews, citing Iranian government census data on which people must list their religion. Other Jewish leaders insisted there were something like 18,000 to 20,000. They based their estimates on their knowledge of communal affiliations in Iran’s various cities. Either way, that’s a big drop from the 80,000 to 100,000 Jews that lived in Iran prior to 1979.

Many of these Jews left in the months immediately after the fall of the shah. A largely business-oriented community, its members often maintained ties to Israel under the shah. Many were shocked into flight when Habib Elghanian, one of the country’s leading businessmen and philanthropists — and the titular head of their community — was executed by a firing squad on charges that included “contacts with Israel and Zionism.”

In 1998, another Jew, Ruhollah Kadkhodah-Zadeh, was executed, reportedly for helping Jews to emigrate illegally.

Shortly after this, restrictions on emigration were lifted. So those who live in Iran today are choosing to do so. Even cash bonus offers from Israel ranging from $10,000 for individuals to $61,000 for families have failed to move those now living there to leave.

According to Moreh Sedgh, those who have stayed are primarily members of the middle class — shop owners, small businessmen and professionals. “The rich had the money to move to America and re-establish themselves there,” he said. “The poor, who had nothing to lose, moved to Israel.” But Najafabadi assured me that a strong contingent of the poor remained among Iran’s Jews.

“We have people who receive charity from the community, including meat, rice and fruit,” he said.

Those making the choice to stay, even as their leaders bristle with hostility toward Zionism and the State of Israel, live under an umbrella of government protection.

Image by Larry Cohler-Esses Jewish hospital

And Jewish life in Iran can be rich. In Tehran alone there are 13 active synagogues, five Jewish schools, two kindergartens and a 100-bed Jewish hospital, where Moreh Sedgh serves as director. There are active communities in several other cities, including Shiraz, Isfahan and Kermanshah, with institutions of their own.

But living as protected second-class citizens under a Shiite Islamist regime is complicated.

As Najafabadi put it: “There is no oppression. But there are limitations.”

Working in the Jews’ favor is the deeply embedded nature of their presence in Iranian society, where they have never been ghettoized, and in which they are seen — and see themselves — as pre-eminently Iranian, woven into 2,700 years of

Iranian history. This facilitates the rigid compartmentalization the government maintains between Zionists, who are seen as a malign outside force, and the unquestioned indigenous character of their own Jewish citizens.

But implicitly, this also means Iranian Jews must take care not to be seen as interested or involved in Israel, though it is an open secret that many have family there, and that many have even visited Israel themselves via third countries.

The Jews’ security is aided by a fatwa that Ayatollah Ruhollah Khomeini, the Islamic Republic’s founder, issued shortly after he came to power. Even as he shifted Iran into an anti-Israel mode, his fatwa declared Iran’s Jews to be a fully protected minority community and forbade any attacks on them.

But Jews’ place in Iranian society is perhaps vouchsafed most by the Jewish community’s own willingness to fight for its right to that place. Its leaders do so while avoiding any challenge to the fundamental legitimacy of Iran’s regime. But it is not a quiet or quiescent Jewish leadership.

Image by Larry Cohler-Esses Shiraz Jewish compound

When then-president Mahmoud Ahmadinejad questioned the historical reality of the Holocaust during his tenure, Jews and others worldwide denounced his statements. But so did Haroun Yashayaei, who was then head of the Tehran Jewish Committee.

“How is it possible to ignore all the undeniable evidence existing for the killing and exile of the Jews in Europe during World War II?” he asked Ahmadinejad in an official letter he wrote the president as head of the committee. Yashayaei condemned Ahmadinejad’s reference to the Holocaust as “a myth,” describing it as “an infected wound for Western civilization.”

Maurice Motamed, who at the time represented the Jewish community in Iran’s parliament, told a reporter for the Persian service of Radio Free Europe/Radio Liberty, “Denial of such a great historical tragedy that is connected to the Jewish community can only be considered an insult to all the world’s Jewish communities.”

In 2012, when Ahmadinejad’s first vice president, Mohammad Reza Rahimi, claimed at a United Nations drug conference that the Talmud teaches “how to destroy non-Jews so as to protect an embryo in the womb of a Jewish mother” and charged that Zionists controlled the world’s illicit drug trade, the community also condemned his remarks.

During Ahmadinejad’s tenure, “there were huge insults toward our religion,” Najafabadi recalled. “He insulted Talmud. And we answered him.”

Outbursts of anti-Semitism did not just stop with Ahmadinejad’s departure in 2013.

Just last April, Alef, a prominent Iranian website run by Ahmad Tavakkoli, a conservative

Member of Parliament, cited Israel’s treatment of the Palestinians and argued: “Blood shedding by Jews is not a new theme…. By examining Jewish history in past centuries, it becomes evident that they insist on blood shedding and even bloodthirstiness based on their altered religion and teachings.”

Nevertheless, the community is vocal about the multiple forms of discrimination under which its members live — but without questioning the legitimacy of the regime or the system of Sharia, or Islamic law, by which it governs.

Image by Larry Cohler-Esses

Their approach could be seen in what community leaders consider one of their biggest recent victories: gaining equality in “blood money” compensation. That’s the amount a person must pay to a family when he is responsible for an accident that caused a family member’s death.

“We succeeded in getting blood money compensation equalized for minorities,”

Motamed said. “Before, there was a big difference between the money for minorities and the main population…. It was a very big achievement.”

But the community’s approach did not involve any criticism of Sharia, which rules on such matters. Instead, Motamed, recalled, “We consulted a lot of ayatollahs and took testimony from high-ranking clerics to show there must be equality” under Sharia.

Pleased as he was, Motamed noted that blood money compensation for non-Muslims remains unequal in cases of murder — and that they are continuing to push on this.

“Under Sharia… if a Muslim kills a Jew, there will be blood money payment. But if a Jew kills a Muslim, the penalty is execution,” he said. Here, too, “we’ve consulted with a lot of ayatollahs and gotten letters. But it’s still not solved.”

Other unresolved issues the leaders cited involved access to high-ranking posts in government ministries and the requirement that a Muslim serve as principal at Jewish schools.

“We have five schools,” Najafabadi said, “and the principals in all of them are Muslim. There’s no enmity. They’re very cooperative. But it’s kind of insulting.”

Then there is inheritance law: Under Sharia in Iran, if one sibling in a non-Muslim family converts to Islam, he inherits the entirety of his parents’ assets. This, too, community leaders are pushing to change.

Image by Larry Cohler-Esses Shiraz Jewish compound.

On Israel, the community’s leadership must be more circumspect. But it is no secret that many in the community have family there, or that a significant number of Jews in Iran have visited Israel themselves. One teenager in Shiraz told me how excited he had been to visit three years ago.

“There are people traveling to Israel,” Najafabadi volunteered. But since the Gaza War of last summer, the government had clamped down, he said. Some who go are imprisoned, fined and interrogated. Two community members had been sentenced to 91 days, though this was later reduced to 20 days. Travel to Israel “is declining now because of these problems,” he said.

Moreh Sedgh even voiced concern for Israel, in his way — his way being to criticize Israel’s policies as harmful for Israel’s own interests.

Speaking about Israel’s policy of opposing Syria’s regime under Bashar al-Assad, which Iran supports, Moreh Sedgh said, “The main enemy of Israel today is Daesh” — a reference to the extremist Islamic State fighting to oust Assad. “Of course, the Assad family are not the ideal leaders for Syria,” he said. But he noted that if Assad is ousted, they “must be ready for ISIS. What benefit for Israel would that be?”

Despite all these issues, those Iranian Jews who choose to stay can live a very active Jewish religious and communal life. My second-to-last night in Iran, I was invited to meet with the local leaders of the Shiraz community in the large open-air compound that serves as their community center. About the size of a football field, the compound is surrounded by high walls that ensure the privacy of those who come. Tables were spread out with ample food, and by 11 p.m., Jewish families totaling some 50 or 60 individuals, including children, were dining and moving around from table to table to catch up on the local gossip.

Image by Larry Cohler-Esses Shiraz Jewish compound pizzeria.

Told I was a vegetarian, the community elders treated me to cheese pizza from the kosher pizzeria on the premises. For meat eaters there was a kosher butcher. And just about everyone used matzo from the matzo factory on the grounds during Passover, I was told. The compound also contained a home for the elderly with nine or 10 residents.

“We are a country of paradox,” Moreh Sedgh said. Noting other recent communal victories, such as permission to close Jewish schools on Saturday, the Jewish Sabbath, rather than Friday, the Muslim day of rest, he said: “Sometimes we do something and have some success…. We think all these problems can be solved as domestic problems. If it comes from the outside. that will make it harder.”

Contact Larry Cohler-Esses at cohleresses@forward.com