Today, Iran’s relationship with the Jewish state — and some say with the Jews — is explosive, or potentially so. It wasn’t always this way.
Jews have been in Iran for more than 2,700 years, arriving before the destruction of the First Temple in 587 BCE and the resultant exile of the Jews from Judea to Babylon (modern-day Iraq). This actually predates the introduction of Islam.
As a result of the defeat of the Babylonian empire in 537 BCE by Cyrus, the founder of the first Persian Dynasty, the captivity of the Jews in Babylon was ended. Many Jews returned to Jerusalem, but others chose to relocate from Babylon to the small Jewish community already based in the area of Iran known as Shushan. Cyrus gave the Jews in Shushan full rights.
Cyrus was followed on the throne by his son, Darius, who in turn was succeeded by Xerxes, who is thought to be the same person as King Ahashuerus of the Book of Esther.
The story of Purim took place in the mid-300s BCE during the rule of the Persian-Median Empire and the Babylonian exile, after the destruction of the First Temple and before the building of the Second Temple. Ahashuerus and Esther are said to be the parents of
another King Darius, who permitted Jews in Persia to return to Jerusalem, something Ahashuerus had prohibited.
Many Jews in the Babylonian exile chose to stay where they had already set down roots and to build a community infrastructure that centuries later would produce the Babylonian Talmud. Today’s Persian Jews trace their lineage back to those communities.
( See Also https://jewishtimes.com/?p=8099 )