Serena Williams is opening up about her 2018 US Open final's loss to Naomi Osaka and what she learned from the emotional moment.

The 23-time Grand Slam champion was defeated by Osaka 6-2, 6-4, but famously argued with an umpire over a warning for coaching during the final.

She was fined $17,000 for code violations for the coaching warning, breaking her racket and alleged "verbal abuse" against the umpire.

In a first-person essay for Harper's BAZAAR, Williams reflected on what she learned from standing up to the umpire, how she coped with the backlash she received and what messages she wants to pass on to her daughter.

"In the end, my opponent simply played better than me that day and ended up winning her first Grand Slam title," she wrote on Osaka. "I could not have been happier for her."

"As for me, I felt defeated and disrespected by a sport that I love -- one that I had dedicated my life to and that my family truly changed, not because we were welcomed, but because we wouldn’t stop winning," she continued.

She described some of her thoughts post-final and how she struggled with understanding what occurred.

"Why can’t I express my frustrations like everyone else? If I were a man, would I be in this situation? What makes me so different? Is it because I’m a woman?" she recalled thinking at the time.

"I was hurt — cut deeply," she continued. "I tried to compare it to other setbacks I’d had in my life and career, and for some reason I couldn’t shake the feeling that this was about so much more than just me."

Williams said that she felt that she'd experienced gender discrimination and the ramifications for men speaking out against what they perceive are bad calls are different.

"So often, in situations similar to mine, when men fight back against the referees, they’re met with a smile or even a laugh from the umpire, as if they’re sharing an inside joke," she wrote. "I’m not asking to avoid being penalized. I am asking to be treated the same way as everyone else."

"Sadly, that’s simply not the world we currently live in," she added.

We are told to sit down and be quiet, which frankly is just not something I’m okay with.

In order to get past what occurred and process the situation, Williams sought out therapy and shared that she realized she wanted to apologize to Osaka.

She wrote that she sent the following message to Osaka:

"Hey, Naomi! It’s Serena Williams. As I said on the court, I am so proud of you and I am truly sorry. I thought I was doing the right thing in sticking up for myself. But I had no idea the media would pit us against each other. I would love the chance to live that moment over again. I am, was, and will always be happy for you and supportive of you. I would never, ever want the light to shine away from another female, specifically another black female athlete. I can’t wait for your future, and believe me I will always be watching as a big fan! I wish you only success today and in the future. Once again, I am so proud of you. All my love and your fan, Serena."

Williams's belief that she did the right thing in speaking up for herself against the umpire was reaffirmed with Osaka's response. "No one has stood up for themselves the way you have and you need to continue trailblazing," Williams said the young woman wrote back to her.

She described that the fight she had with the umpire during the final, "exemplified how thousands of women in every area of the workforce are treated every day."

"We are not allowed to have emotions, we are not allowed to be passionate," she continued. "We are told to sit down and be quiet, which frankly is just not something I’m okay with. It’s shameful that our society penalizes women just for being themselves."

Williams also promised she will never "stop raising my voice against injustice."

The tennis legend finished her passionate letter by describing what she's had to overcome throughout her career and what motivates her to keep pushing forward.

"As a teenager, I was booed by an entire stadium ... I’ve been called every name in the book. I’ve been shamed because of my body shape," she wrote. "I’ve been paid unequally because of my sex. I’ve been penalized a game in the final of a major because I expressed my opinion or grunted too loudly. I’ve been blatantly cheated against to the point where the Hawk-Eye rules were introduced so that something like that would not happen again. And these are only the things that are seen by the public."

"In short, it’s never been easy," she added. "But then I think of the next girl who is going to come along who looks like me, and I hope, 'Maybe, just maybe, my voice will help her.'"

Read Serena Williams essay in full at Harper's BAZAAR.