The first woman to receive the prestigious Fields Medal for mathematics, Maryam Mirzakhani, has died in the US.

The 40-year-old Iranian who was a professor at Stanford University in California, died after the cancer she had been battling for four years spread to her bone marrow.

Nicknamed the “Nobel Prize for Mathematics”, the Fields Medal is only awarded every four years to between two and four mathematicians under 40.

Prof Mirzakhani received the award in 2014 for her work on complex geometry and dynamical systems.

Congrats to #MaryamMirzakhani on becoming the first ever woman to win the #FieldsMedal, making us Iranians very proud pic.twitter.com/oVL98NRdVF — Hassan Rouhani (@HassanRouhani) August 13, 2014

“A light was turned off today. It breaks my heart… gone far too soon,” her friend, Nasa scientist Firouz Naderi, posted on Instagram.

Born in 1977, Prof Mirzakhani was brought up in post-revolutionary Iran and won two gold medals in the International Mathematical Olympiad as a teenager.

She earned a PhD at Harvard University in 2004, and later a professorship at Stanford.

Her receipt of the Fields Medal three years ago ended a long wait for women in the mathematics community for the prize, first established in 1936.

Prof Mirzakhani was also the first Iranian to receive it.