Maryam Mirzakhani of Iran, the first woman recipient of the Fields Medal for mathematics, died here at the age of 40.

The Stanford University professor died on Saturday after a four-year battle with cancer, reports Efe news.

Mirzakhani's friend and compatriot, NASA scientist Firouz Naderi, mourned her death on Twitter.

"A light was turned off today. It breaks my heart… gone far too soon," he wrote, while Iranian President Hassan Rouhani called Mirzakhani's death "very much heartrending".

Created in 1936, the Fields Medal, popularly known as the "Nobel Prize for Mathematics", is awarded every four years to a maximum of four mathematicians under the age of 40.

In 2014, Mirzakhani became both the first woman and the first Iranian to receive the honour, in recognition of "her outstanding contributions" in the area of complex geometry.

Born in 1977, Mirzakhani won two gold medals in the International Mathematical Olympiad during her teenage years and graduated from the Sharif University of Technology in Tehran in 1999 before going on to earn a doctorate from Harvard.

Mirzakhani is survived by her husband and their daughter.