"I felt that this was something I could do, and I wanted to pursue this path."

Mirzakhani said she enjoyed pure mathematics because of the elegance and longevity of the questions she studies.

"It is like being lost in a jungle and trying to use all the knowledge that you can gather to come up with some new tricks, and with some luck you might find a way out," she added.

In 2008 she became a professor of mathematics at Stanford. She is survived by her husband, who is also a Standford University maths researcher, and their young daughter.

'Great sorrow'

In Iran, President Hassan Rouhani said that Mirzakhani's "doleful passing" has caused "great sorrow," state media reported.

Rouhani praised the "unprecedented brilliance of this creative scientist and modest human being, who made Iran's name resonate in the world's scientific forums, (and) was a turning point in showing the great will of Iranian women and young people on the path towards reaching the peaks of glory...in various international arenas."

Rouhani also re-posted on Twitter a 2014 tribute with photos of Mirzakhani wearing a veil and without a veil.

Separately on Instagram, Iranian Foreign Minister Mohammad Javad Zarif said that Mirzakhani's death is a cause for grief for all Iranians.

Mirzakhani became known on the international mathematics scene as a teenager, winning gold medals at both the 1994 and 1995 International Math Olympiads -- and finished with a perfect score in the latter competition.

She went on to win the 2009 Blumenthal Award for the Advancement of Research in Pure Mathematics, and the 2013 Satter Prize of the American Mathematical Society.

Mirzakhani studied mathematics in Iran and earned a PhD degree from Harvard in 2004. She then taught at Princeton University before moving to Stanford in 2008.

The Fields Medal, which she won in 2014, is given out every four years, often to multiple winners aged 40 or younger.