At some point in their lives, up to one fifth of women experience painful sex (a.k.a. dyspareunia). The condition is described as persistent and recurring pain that be felt in the vagina, clitoris or labia at any point before, during and after intercourse.

There are numerous reasons for this complaint, says Mary Jane Minkin, MD, clinical professor of obstetrics and gynecology and reproductive sciences at Yale School of Medicine. Painful sex may be linked to women being post- or pre-menopausal, or it may be connected to some other internal problem.

In post-menopausal women, vaginal dryness often causes painful or uncomfortable sexual intercourse. Vaginal lubricants, long-acting vaginal moisturizers or vaginal estrogen can alleviate this problem. Among pre-menopausal women, vaginitis (any infection or inflammation of the vagina) and other vaginal infections, such as bacterial vaginosis, yeast infection, trichomoniasis and chlamydia, can cause painful sex.

But if you feel pain beyond the vagina, other internal reproductive conditions could be the culprit. For example, if you’re pre-menopausal and the pain is higher up in the pelvis—particularly if it occurs with a partner’s deeper thrusting—then pelvic inflammatory disease, endometriosis or fibroids may be the cause.

Women with endometriosis (a painful condition that occurs when uterine tissue grows outside of the uterus on other organs or structures in the body) can have problematic scar tissue removed, or they can use hormonal contraceptive therapy. But those with pelvic inflammatory disease require antibiotic therapy.

If you’re experiencing painful sex, consult your gynecologist. After all, for sex to be healthy, it’s about pleasure, not pain.