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.

“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.”

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

Britney Spears and Justin Timberlake, arriving at the 28th annual American Music Awards, held at the Shrine Auditorium.

Britney Spears and Justin Timberlake in January 2001.FRANK TRAPPER/CORBIS VIA GETTY

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.”

 Britney Spears Opens Up: ‘Finally Free’ to Share Her Story in Bombshell Memoir & New Interview — ‘No More Lies’ (Exclusive)

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.

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

Britney Spears, The Woman In Me Book Cover

‘The Woman in Me’ by Britney Spears.
Britney Spears Recalls Kissing Justin Timberlake Playing Truth or Dare at Mouseketeer Sleepover (Exclusive)

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.

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.”

Justin Timberlake & Britney Spears during Super Bowl XXXVI - Britney Spears & Justin Timberlake Host Super Bowl Fundraiser at Planet Hollywood Times Square at the Planet Hollywood Times Square in New York City, NY

Justin Timberlake and Britney Spears in 2002. DENISE TRUSC / GETTY