Britney Spears is sharing a painful experience she’s kept private for 20 years.

In her upcoming memoir The Woman in Me, the pop icon reveals that when she dated Justin Timberlake, she became pregnant with his baby but had an abortion, PEOPLE confirms.

Britney Spears Reveals She Had An Abortion Because Of Justin Timberlake |  Bored Panda

“It was a surprise, but for me, it wasn’t a tragedy. I loved Justin so much. I always expected us to have a family together one day. This would just be much earlier than I’d anticipated,” Spears, now 41, writes of the pregnancy in the book. “But Justin definitely wasn’t happy about the pregnancy. He said we weren’t ready to have a baby in our lives, that we were way too young.”

Britney Spears Reveals How She and Justin Timberlake Kept Her Abortion a  Secret

A rep for Timberlake did not immediately respond to PEOPLE’s request for comment.

She writes in the book: “If it had been left up to me alone, I never would have done it. And yet Justin was so sure that he didn’t want to be a father.”

Spears writes of her experience undergoing the abortion: “To this day, it’s one of the most agonizing things I have ever experienced in my life.”

After Spears and Timberlake split in 2002, she went on to become a mother, welcoming two sons — Sean Preston, 18, and Jayden James, 17 — with her second husband, Kevin Federline.

Britney Spears Reveals She Had an Abortion While Dating Justin Timberlake

Spears will release her much-anticipated memoir on Oct. 24, through Gallery Books, an imprint of Simon & Schuster.

The memoir comes nearly two years after Spears was released from her court-ordered conservatorship, which had been in place for 13 years. The conservatorship was terminated in November 2021 after Spears gave fervent public testimony in court in June 2021.

Britney Spears Reveals She Had Abortion After Justin Timberlake Told Her He  'Didn't Want to Be a Father'

Promising to reveal “for the first time her incredible journey (and) strength at the core of one of the greatest performers in pop music history,” according to a press release from Gallery Books, the singer’s memoir “illuminates the enduring power of music and love — and the importance of a woman telling her own story, on her own terms.”