But they do happen, because enforcement can go only so far in a society completely changed over the last 40 years. While prosecutions can result in fines or even caning, they are not common, and on Tuesday, thousands of men and women danced in the streets to celebrate the Iranian national soccer team’s earning of a spot in the World Cup.

Today, many Iranians shrug off most of these sins, saying it should be up to individuals to decide if they commit any.

In practice, this means that popular but proscribed activities, including Zumba dancing, are often tolerated if they take place semi-hidden or under a different name.

“I taught Zumba for years here,” Ms. Nafisi said. “But instead of calling it Zumba, I called it ‘exercise to music’ so no one would notice.”

Other names used for the classes have included “body rhythm,” “advanced aerobics” and “Mumba.”

Then, in a sequence of events not uncommon in Iran, another Zumba instructor started calling her classes by their real name four years ago. When the authorities did not react, many other instructors, including Ms. Nafisi, swiftly followed.

“Suddenly it became free,” she said. “Maybe they just stopped caring.”

Until this month. In a letter, the head of the Sports for All Federation, Ali Majd Ara, decided that Zumba wasn’t one of the accepted sports. The problem: Making “rhythmic movements” or “dancing” is illegal, his letter said.

“Considering that activities such as Zumba, performance of rhythmic movements and dancing in any form and under any title lacks legal credibility, I request that you issue an order to ban such movements,” Mr. Ara wrote in a letter to a provincial official, which was published by the semiofficial Islamic Students News Agency. Given Mr. Ara’s position, the letter was seen as amounting to a nationwide ban.