Hassan rouhani
Wearing the hijab has been compulsory for women in Iran since 1979, with punishment of prison or cane lashes for non-compliance Twitter @HassanRouhani

A tweet by the president of Iran has fuelled hopes that the punishing law that makes it compulsory for women to wear the hijab could be relaxed.

President Hassan Rouhani posted images of Mayam Mirzakhani - who this week became the first woman to win the coveted Fields Prize, which is nicknamed the "Nobel Prize for mathematics" - on his Twitter channel.

In the split image, Mirzakhani was pictured wearing the hijab or headscarf and in the second image without any head-coverings.

Wearing the hijab has been compulsory for women in Iran since the 1979 Revolution, and the lack of it is punishable by imprisonment, cane lashes or fines.

Rouhani's tweet has been hailed as a major step forward for women's rights in Iran, following a call for lighter headscarves, or even no headscarf at all, to be permitted.

The president is the highest-ranking elected official in Iran. He was voted in in 2013 and has publicly stated that he favours a more liberal approach to Islamic modes of dressing. The 65-year-old has been celebrated by much of the Western world for his more moderate beliefs than previous leaders, although some have questioned the legitimacy of this view.

This isn't the first time Rouhani's Twitter account has attracted public controversy. In May, he issued his support for a group of Iranian men who had been arrested in the country for creating a musical tribute to the Pharrell Williams song, Happy. He tweeted: "#Happiness is our people's right. We shouldn't be too hard on behaviours caused by joy."

The English-language account is not managed by the president personally but is run by his close aides.

Mirzakhani, 37, was born in Iran but now lives in the US where she is a professor of mathematics at Stanford University in California. She was awarded the 2014 Fields Medal for her sophisticated contributions to the fields of geometry and dynamical systems.