Lena Dunham, the star and creator of the HBO comedy series Girls, has undergone radical surgery to remove her uterus and cervix in an attempt to rid herself of the debilitating disease endometriosis.

The actor, 31, announced her total hysterectomy in an essay in Vogue. She hopes to end the chronic pain she has suffered as well as the “years of complex surgeries measuring in the double digits”.

The decision was a tough one, Dunham said. “I never had a single doubt about having children,” she wrote. “As a child, I would stuff my shirt with a pile of hot laundry and march around the living room beaming.”

But, she said, she knew just as intensely that there was something wrong with her uterus. And in August last year, the pain became unbearable.

“With pain like this, I will never be able to be anyone’s mother. Even if I could get pregnant, there’s nothing I can offer.”

In November, she checked into hospital and said she would not leave until doctors stopped the pain or gave her a hysterectomy.

She wrote that she wanted to cry as she was wheeled towards the operating room. But, she said: “I gave up on more treatment. I gave up on more pain. I gave up on more uncertainty.”

What is endometriosis? A guide Read more

Endometriosis, which affects an estimated 176 million women worldwide, was for decades a taboo subject – a disease caused by tissue similar to the lining of the womb growing elsewhere, most commonly in the abdomen, ovaries, rectovaginal septum, bladder and bowel.

The tissue behaves like the lining of the womb, bleeding every month, and it can cause such severe and chronic pain that women pass out or are admitted to hospital. Surgery is complex because the tissue grows around organs and fuses them together.

Many women suffer every month for years, unable to attend school, college or their job because of the crippling pain. Doctors do not always recognise endometriosis, assuming it is period pain. If women are referred to a gynaecologist and diagnosed, they may still not get specialist treatment for a condition which is still not well understood.

Dunham has been vocal about her suffering. She has tried every sort of alternative treatment, and lists “pelvic floor therapy, massage therapy, pain therapy, color therapy, acupuncture” and yoga among them. Neither those nor conventional medical interventions worked long-term.

She has been admitted to hospital three times in less than a year. She thought it was all over last April, when she announced she was free of endometriosis after surgery to separate her ovaries from her rectal wall. During her appearance at the Met Gala in New York a few weeks later, however, she was rushed to hospital with complications.

Dunham promptly cancelled her nationwide Lenny IRL tour of six cities. She told fans she was “in the greatest amount of physical pain that I have ever experienced” after doctors discovered more endometriosis.

Experts say the lack of research and funding for a disease that affects one in 10 women of reproductive age is a scandal.

“Endometriosis affects women in the prime of their life. It is not a lifestyle disease. It is not a disease you get later in life. It attacks teens, young women when they should be out being active, working, having children, having sex – 50% of them are struggling with sex because it is too painful,” Lone Hummelshoj, who heads the World Endometriosis Research Foundation and the World Endometriosis Society, told a Guardian investigation.

Surgery can end a woman’s suffering if all the rogue tissue is removed. Dunham’s total hysterectomy will only be a cure if none is found elsewhere in her abdomen or bowel.

Dunham is not the only celebrity to have tried to break the silence around endometriosis. Others affected include Emma Bunton, Dolly Parton, Anna Friel, Hilary Mantel, Susan Sarandon and Whoopi Goldberg. After the Guardian’s investigation, the former MP Oona King spoke out in the House of Commons about her experiences

Dunham said she has found she can rejoice when her friends are pregnant, even though she never will be. “I may have felt choiceless before, but I know I have choices now,” she wrote. “Adoption is a thrilling truth I’ll pursue with all my might.”