Girls star Lena Dunham has thanked fans for their support after she revealed she had undergone a total hysterectomy.

The actress and writer wrote about her decision to have the procedure – the surgical removal of the cervix and uterus – in an essay for Vogue magazine earlier this week.

The Metropolitan Museum of Art Costume Institute Benefit Gala – New York
Lena Dunham attending The Metropolitan Museum of Art Costume Institute Benefit Gala 2017 (Aurore Marechal/PA)

In a lengthy essay, the 31-year-old explained she had decided on the operation after years of pain caused by endometriosis.

Following her reveal, she thanked fans on Instagram for the outpouring of support as she opened up about being “heart broken”.

She wrote: “Your body failing you is a loss that’s hard to explain and yet the amount of messages I’ve gotten from women in a similar predicament has been so overwhelming, loving and heartening.

“More than 60 million women in America are living with hysterectomies and those of you who’ve shared your plight and perseverance make me feel so honored to be in your company.

“Thank you to the village of women who took care of me through this entire process.

“I have a broken heart and I hear those don’t mend overnight, but we are linked forever by this experience and our refusal to let it hold any of us back from even the grandest dreams.”

In a series of Tweets echoing her Instagram message, she also added: “My illness & choice was just that: MY choice. I’m not a doctor and I SURE DON’T CLAIM TO BE, but sharing this piece which delves deeper into the options women have. My decision was what was best for me and I hope this helps you make the best decision for you & your health 3/4.”

In her original essay for Vogue, excerpts of which were republished by the Endometriosis Foundation of America, she said she would also explore adoption.

She wrote: “I may have felt choiceless before, but I know I have choices now.

“Soon I’ll start exploring whether my ovaries, which remain someplace inside me in that vast cavern of organs and scar tissue, have eggs. Adoption is a thrilling truth I’ll pursue with all my might.”

Endometriosis is a painful condition that occurs when tissue that lines the uterus is found outside it.