Why are Iranian hard-liners once again setting their sights on women? Some 2,000 Iranian women and men demonstrated last week  in the city of Isfahan, and others gathered before the parliament building in Tehran, to protest a series of acid attacks on women and to demand government action.

The acid attacks, which have resulted in blindness, facial disfigurement and at least one death, coincided with the introduction of legislation that would protect people behind such atrocities. The Bill for the Protection of Chastity and Veiling ostensibly bans violence against women and other violators of “morals” and “decency.” In fact, it strengthens the morals police and security authorities and protects others who take measures on the streets to enforce the Islamic injunction to “promote the good and forbid evil.”

If enacted, the legislation is certain to encourage further harassment and attacks against women. It would mean that, once again, women could be stopped on the street by passersby if they show a bit of hair or are not dressed according to a strict Islamic code. Women who violate these “decency” laws would be required to attend a class on proper veiling; a second infraction would incur a sizable monetary fine. The law also requires that men and women be separated in the workplace.

Parliamentarians’ renewed obsession with women’s dress and male-female workplace mixing represents a throwback to the early days of the Islamic revolution, when women who did not observe the Islamic dress code were subject to 70 lashes and when men and women were segregated in university classrooms, buses and elsewhere. The flogging law remains on the books; many women fear it may be enforced again in the hostile environment that is emerging. Demonstrators in Isfahan and Tehran carried placards with messages that included “Stop violence against women,” ”Cancel anti-women laws,” and ”A safe street is my right.”

Police dispersed the demonstrators but refrained from using excessive force, apparently wishing to avoid a repeat of the violent confrontations of  2009, when almost a million people poured into the streets of Tehran to protest the presidential election that gave then-President Mahmoud Ahmadinejad a second term. Those demonstrations were harshly suppressed. Hundreds were jailed; there were credible reports of brutal mistreatment and deaths of some prisoners; and mass show trials followed. This time, police chiefs quickly promised to find and arrest the perpetrators of the acid attacks, and President Hasan Rouhani appointed three cabinet ministers to get to the bottom of Isfahan incidents. Hard-liners in the regime remain loath to concede that their own anti-feminist rhetoric has encouraged the attacks. The chief of the powerful paramilitary forces, the basij, blamed foreign intelligence agencies for the attacks. The head of Iran’s judiciary charged that Iranian media coverage of the incidents was an example of “clear injustice to the regime and the believers.”

Against this backdrop, it seemed intentionally provocative that the Tehran prosecutor’s office announced the execution of 26-year-old Rayhaneh Jabbari. Ms. Jabbari became a cause celebre after she was arrested for killing a man who tried to sexually assault her. She had been on death row since 2009; earlier this month, Iran’s supreme court rejected her appeal. Iranian and Western human rights organizations and foreign governments had urged that her death sentence be commuted, to no avail. Along with China, Iran leads the world in the number of judicially ordered executions. Already this year, 250 people have been executed.

What might explain hard-liners’ sudden refocus on women? Iranian women long ago abandoned strict observance of the Islamic dress code, and gender mixing in the workplace is widespread, including in government offices. The answer may lie in the agenda President Rouhani has pursued since his election. He has sought to open the public space for all Iranians, including women and the young, and has argued that morality cannot be imposed with the whip.

Conservatives and hard-liners, opposed to this approach and even more opposed to a political opening that might follow, have sought to undermine the president. They seem to believe that by reviving the issue of women and their supposedly endangered morality, they have found a club with which to effectively bludgeon the president. The message they want to send to all Iranians? Your fate is in our hands and your popularly elected president is just an ineffective bystander.

The question now is whether President Rouhani will respond forcefully to this challenge.

The opinions expressed here are solely those of the author. 

The article was originally published in The Wall Street Journal's Washington Wire.