However, a strong homosexual tradition in Iran is attested to by Greek historians from the 5th century onward, and so the prohibition apparently had little effect on Iranian attitudes or sexual behavior outside the ranks of devout Zoroastrians in rural eastern Iran.
In Persian poetry, references to sexual love can be found in addition to those of spiritual/religious love.
A few ghazals (love poems) and texts in Saadi's Bustan and Gulistan have been interpreted by Western readers as homoerotic poems.
Under the rule of Mohammad Reza Pahlavi, the last monarch of the Pahlavi Dynasty, homosexuality was tolerated, even to the point of allowing news coverage of a same-sex wedding.
Ancient commentary on this passage suggests that those engaging in sodomy could be killed without permission from the Dastur.
Since the 1979 Iranian revolution, the legal code has been based on Islamic Shari'a law.
All sexual relations that occur outside a traditional, heterosexual marriage (i.e.
Testimony of women alone or together with a man does not prove sodomy. "If sodomy, or the lesser crimes referred to above, are proved by confession, and the person concerned repents, the Shari'a judge may request that he be pardoned.
If a person who has committed the lesser crimes referred to above repents before the giving of testimony by the witnesses, the punishment is quashed. The judge may punish the person for lesser crimes at his discretion.