​Tennis legend Serena Williams spoke at the TED Conference in Vancouver Tuesday, touching on her pregnancy and the future of her athletic career.

The 35-year-old revealed that she was expecting a baby last week. She was pregnant when she won the Australian Open in January.

Speaking on Tuesday, Williams said she found out about her pregnancy just two days before the tournament kicked off.

"I was nervous. I wasn't quite sure what to think, but I knew that at that moment, it was really important for me to just focus," she told interviewer Gayle King. 

Williams went on to win her 23rd Grand Slam singles title at the championship, setting a record for the Open era — something she said was no breezy feat, even for her. 

Serena-Williams-Baby

Williams after winning 2017 Australian Open in January. (Scott Barbour/Getty Images)

"It wasn't very easy. You hear all these stories about people when they're pregnant — they get sick, they get really tired, really stressed out ... I had to really take all that energy and put it in a paper bag, so to say, and throw it away.

"Pregnant or not, no one knew and I was supposed to win that tournament. Every time I play, I'm expected to win. If I don't win, it's actually much bigger news."

Accidental announcement

Williams revealed her pregnancy by posting a picture of herself on Snapchat captioned "20 weeks." 

On Tuesday, the mom-to-be said the photo was actually meant to be a private one.

"I have this thing where I've been checking my status and taking pictures every week to see how far along I'm getting ... I was just saving them [for myself,]" she told the crowd. "I've been so good about it, but this was the one time it slipped."

williams

Williams said this Snapchat photo went public by accident, sending the internet into a frenzy. (Snapchat/Serena Willliams)

On leadership

The player also touched briefly on her response to "racist" and "sexist" comments made by former No. 1 player Ilie Nastase.

Nastaste, who won two Grand Slam titles in the '70s, swore at British players Johanna Konta and Anne Keothavong at an event last week. He was also quoted as saying, "Let's see what colour it has. Chocolate with milk?" in response to Williams' pregnancy news, 

Williams responded on her Instagram account, defending her peers and her unborn baby.

"It's really important to hold women up. These young women will come to the locker room and they'll want to take pictures with me, and for me, it's like, 'I want to be a good leader and a good example for them,' she explained Tuesday.

"I felt it was important for us to stand up for each other and to stand up for myself ... it was really important for me to say 'I'm not afraid, I'm not going anywhere, but this is inappropriate.'"

'I'm not done yet'

The 35-year-old athlete, who is taking the rest of 2017 away from tennis, also touched on her plans for her career post-baby.

"I definitely plan on coming back. I'm not done yet," Williams said, adding that she draws inspiration from her sister Venus, 36.

"If she's still playing, I know I can play," she joked. "This [motherhood] is just a new part of my life. My baby's going to be in the stands and hopefully cheering for me."

Watch Williams' talk in full below:

With files from the Canadian Press