Image copyright Gershad Image caption If Iranians get on the wrong side of an Ershad patrol their evening out can end very fast.

An anonymous team of Iranian app developers have come up with a solution to help young fashion conscious Iranians avoid the country's notorious morality police known in Persian as "Ershad" or guidance.

Ershad's mobile checkpoints which usually consist of a van, a few bearded men and one or two women in black chadors, are deployed in towns across Iran and appear with no notice.

Ershad personnel have a very extensive list of powers ranging from issuing warnings and forcing those they accuse of violating Iran's Islamic code of conduct, to make a written statement pledging to never do so again, to fines or even prosecuting offenders.

The new phone app which is called "Gershad" (probably meaning get around Ershad instead of facing them) however, will alert users to checkpoints and help them to avoid them by choosing a different route.

The data for the app is crowdsourced. It relies on users to point out the location of the Ershad vans on maps and when a sufficient number of users point out the same point, an alert will show up on the map for other users. When the number decreases, the alert will fade gradually from the map.

Image copyright Twitter/@nima Image caption The app uses data from users to pinpoint where mobile checkpoints have been placed.

In a statement on their web page the app's developers explain their motives in this way: "Why do we have to be humiliated for our most obvious right which is the right to wear what we want? Social media networks and websites are full of footage and photos of innocent women who have been beaten up and dragged on the ground by the Ershad patrol agents."

"Police need to provide security for the citizens not to turn into a factor for fear. A while ago, angry with such unreasonable oppressions, we looked for a solution to find a practical way to resist the volume of injustices peacefully with low risk level, to restore part of our freedom."

The app has rapidly become a hot topic on Iranian social media, with users generally welcoming it as an innovative way to avoid a potentially unpleasant encounter with the guardians of national virtue. "This is great," said one comment. Another posted: "This is a good and interesting idea. I just hope that the security level is also high so that no one can track down the person who reported the location of Ershad".

On Twitter, one user wrote: "I don't really care if the application works or not but each download is a protest." But another was concerned that the app could have unintended consequences: "I don't agree with what Ershad patrol does. But with Gershad, they are disturbing the police activities. What if there is an app asking everyone to show the traffic police's location - the result will be car accidents"

And a cleric tweeted: "God has ordered us to encourage people to do good, and forbid them from doing wrong, and the way to do it is not the morality police. But the way to solve the morality police issue is not this app either. I am worried about the impact of this work in the future."

According to the designers of Gershad, in 2014 alone, around three million people were issued with official warnings, 18,000 were prosecuted and more than 200,000 were made to write formal pledges of repentance.

Follow BBC Trending on Facebook

Join the conversation on this and other stories here.

The range of offences which Ershad patrols deal with are extensive. From wearing too much makeup in public to wearing too little Hijab or head cover for women, to what is called western influenced hair style and trendy clothing for men.

Just exactly what amounts to immoral behaviour, can be widely open to the interpretation of the Ershad agent on the spot. So buying your clothes and or makeup from authorised shops, won't necessarily keep you out of trouble. If an Ershad agent sees the combination unfit according the Sharia code of conduct, you can still end up being warned or even prosecuted.

Also, if you're caught walking or riding with your opposite sex friend, you still could end up being stopped, questioned and prosecuted by Ershad because that's another violation of Islamic code of conduct.

If the app, lives up to the claims made for it, Gershad will be a lifesaver for the growing numbers of young Iranians who are pushing the boundaries of what is allowed and finding themselves on the wrong side of what an Ershad agent sees as acceptable.

Blog by Amir Azimi

Next Story: 'We are not criminals' Nigerians tell their president

Image copyright Getty Images

Nigeria's President Buhari angers many of his citizens by telling foreign media that Nigerians are partially to blame for negative perceptions of them abroad. READ MORE