Serena Williams is as much of a role model off the court as she is on it. The 40-year-old athlete recently sat down for a conversation with Selena Gomez where she spoke openly about her mental health and how she learned years ago that it’s healthy for her to have boundaries.

“Mental fitness for me is just really learning to shut down,” Williams said in the interview for Gomez’s mental health platform, Wondermind,. “And you know I did this years ago, before even mental health was a topic among everyone’s mind. It was more just like, alright, I’m shutting myself down today. Just subconsciously, it was something I’ve always done.”

“And so now that I know that it’s so important to just put yourself first, especially mentally, I always have shut down moments. I have serious boundaries and I don’t let anyone cross those boundaries,” the tennis pro continued. “For me, it’s so important to make sure, every day, I have a period of, like — it’s so bad, because I really don’t do anything for me, I’m terrible at that. And I’ve said it time and time again – I’m working on it. But more or less, at least prioritizing what I need to do. And then when I’m turned off, I’m turned off.”

During their conversation, Williams also detailed how it’s important for her to mentally be in a good place in order to show up each day, not only for her career, but as a mom to her 4-year-old daughter, Olympia, whom she shares with husband Alexis Ohanian.

“It’s really about managing and how you’re able to do it,” Williams said of both physical and mental health. “It’s about being able to kind of manage your emotions and feelings and everything else still be able to perform [in day-to-day life.]”

Williams’ sit-down with Gomez comes just days after she penned an essay for Vogue announcing her decision to step back from her tennis career and focus on expanding her family.

“I’m here to tell you that I’m evolving away from tennis, toward other things that are important to me,” she wrote. “A few years ago I quietly started Serena Ventures, a venture capital firm. Soon after that, I started a family. I want to grow that family.”

“In the last year, Alexis and I have been trying to have another child, and we recently got some information from my doctor that put my mind at ease and made me feel that whenever we’re ready, we can add to our family,” she continued. “I definitely don’t want to be pregnant again as an athlete. I need to be two feet into tennis or two feet out.”

While she noted that saying goodbye to the sport is “the hardest thing that I could ever imagine,” Williams knows it’s what is needed right now.

“The way I see it, I should have had 30-plus grand slams. I had my chances after coming back from giving birth. I went from a C-section to a second pulmonary embolism to a grand slam final,” she wrote. “I played while breastfeeding. I played through postpartum depression. But I didn’t get there. Shoulda, woulda, coulda. I didn’t show up the way I should have or could have. But I showed up 23 times, and that’s fine. Actually it’s extraordinary. But these days, if I have to choose between building my tennis résumé and building my family, I choose the latter.”

MORE FROM ET: 

Serena Williams Gets Choked Up as She Begins Her Farewell Tour to Tennis

Serena Williams Announces Intention to Retire From Tennis

Venus Williams Claps Back at Reporter’s Questions at Wimbledon