In this file photo taken on April 22, 2007, Iranian police officers stop a car during a crackdown to enforce the Islamic dress code in the north of the capital Tehran. AFP
Women-led protests, labelled "riots" by the authorities, have swept Iran since the 22-year-old Iranian of Kurdish origin died on September 16, three days after her arrest by the morality police in Tehran.
"Morality police have nothing to do with the judiciary" and have been abolished, Attorney General Mohammad Jafar Montazeri was quoted as saying by the ISNA news agency.
His comment came at a religious conference where he responded to a participant who asked "why the morality police were being shut down", the report said.
The morality police -- known formally as the Gasht-e Ershad or "Guidance Patrol" -- were established under hardline president Mahmoud Ahmadinejad, to "spread the culture of modesty and hijab", the mandatory female head covering.
The units began patrols in 2006.
The announcement of their abolition came a day after Montazeri said that "both parliament and the judiciary are working (on the issue)" of whether the law requiring women to cover their heads needs to be changed.
President Ebrahim Raisi said in televised comments Saturday that Iran's republican and Islamic foundations were constitutionally entrenched "but there are methods of implementing the constitution that can be flexible".
The hijab became mandatory four years after the 1979 revolution that overthrew the US-backed monarchy and established the Islamic Republic of Iran.
Morality police officers initially issued warnings before starting to crack down and arrest women 15 years ago.
The vice squads were usually made up of men in green uniforms and women clad in black chadors, garments that cover their heads and upper bodies.
The role of the units evolved, but has always been controversial even among candidates running for the presidency.
Clothing norms gradually changed, especially under former moderate president Hassan Rouhani, when it became commonplace to see women in tight jeans with loose, colourful headscarves.
But in July this year his successor, the ultra-conservative Raisi, called for the mobilisation of "all state institutions to enforce the headscarf law".
Raisi at the time charged that "the enemies of Iran and Islam have targeted the cultural and religious values of society by spreading corruption".
In spite of this, many women continued to bend the rules, letting their headscarves slip onto their shoulders or wearing tight-fitting pants, especially in major cities and towns.
Iran's regional rival Saudi Arabia also employed morality police to enforce female dress codes and other rules of behaviour. Since 2016 the force there has been sidelined in a push by the Sunni Muslim kingdom to shake off its austere image.