The Iranian Actress Afsaneh Bayegan.
"Afsaneh Bayegan was sentenced to two years in prison, suspended over five years, for wearing a hat and failing to comply with the hijab law," Fars news agency reported.
The law requires women to cover their head and neck in public.
The court also ordered Bayegan to make weekly visits to a psychological centre "to treat the mental disorder of having an anti-family personality" and to submit a health certificate after her treatment, it said.
The verdict also bans her from using social media and leaving the Islamic republic for two years, Fars added.
The ruling came after the 61-year-old actress appeared at a movie ceremony without wearing a headscarf and then shared photos on social media.
Wearing a hijab has been compulsory for all Iranian women since shortly after the 1979 Islamic revolution.
Bayegan had also expressed support for last year's protests triggered by the death in police custody of 22-year-old Iranian Kurd Mahsa Amini, who had been arrested in September for allegedly violating the strict dress code.
Bayegan rose to prominence after the 1979 revolution and is best known for her role in "Sarbedaran", a television series about Iran's resistance to Mongol invasion in the 14th century.
Women in Iran have increasingly flouted the dress code since the protests, and on Sunday state media reported increased police patrols aimed at catching those ignoring the law.
Short link: