TEHRAN — A troupe of young dancing girls throwing rose petals may have ended the career of Tehran’s mayor, who suddenly resigned on Wednesday.

The mayor, Mohammad Ali Najafi, attended a celebration last week amounting to an Islamic version of Mother’s Day. There he encountered six girls dancing in traditional costumes and throwing the rose petals in honor of a female saint.

There is a ban on dancing in public, however, for women in the Islamic republic — and girls older than 9 are regarded as women by clerics, who resist any change in social norms.

Mr. Najafi, a 66-year-old graduate of the Massachusetts Institute of Technology who came to lead the capital promising change, did not leave the auditorium when the girls took the stage. A video of the event shows him immersed in paperwork as they twirl around and are handed baskets of rose petals by a grown-up.