Police in the Iranian capital Tehran have announced they will no longer arrest people they deem to have breached Islamic values such as women with their heads uncovered in public, according to media reports.

The move came after Iran’s bitter rival Saudi Arabia eased some of its ultraconservative laws by announcing plans to allow women to drive and attend sports matches in stadiums.

Women in Iran have had to wear headscarves in public since the country’s revolution in 1979 and women have been imprisoned, lashed and fined for leaving part of their hair uncovered and wearing nail polish and heavy makeup.

More:Saudi Arabia says it will allow women to drive for first time

More:Saudi Arabia will let women drive, but there's a long way to go. Everywhere

“Based on a society-oriented, educational approach, the police will not arrest those who don’t respect Islamic values. It will instead educate them,” said Tehran police chief Gen. Hossein Rahimi, the Wall Street Journal reported, citing the official Islamic Republic News Agency.

The rules will remain in place outside Tehran.

More:Hijab becomes symbol of resistance, feminism in the age of Trump

More:In some affluent circles in Egypt, the hijab and burkini just won't do

Those who contravene Islamic codes will have to attend classes given by the police, and repeat offenders may still be prosecuted, the semi-official Tasnim news agency reported.

Many on social media asked for clarity about what is and is not permitted to avoid arrest.

President Hassan Rouhani was re-elected by a landslide in May after promising a modern and moderate Iran, in contrast to his rival, the hardline cleric Ebrahim Raisi.

Many young Iranians have consistently pushed the boundaries of the strict dress code, but hardliners are against change.

More:First hijab-wearing Barbie based on Olympian Ibtihaj Muhammad

More:Saudi women got the right to drive, but here are 6 things they still can’t do