The stars seemed to be aligning for Serena Williams.

By the time she took the court for her fourth-round match against Elena Rybakina at the French Open on Sunday, Williams was the highest-seeded player and the only top-20 player remaining on her side of the draw. In fact, she was the only one who had ever reached the semifinals at a major — something she has done 40 times throughout her career.

Even her presumed quarterfinal opponent, Victoria Azarenka, the two-time major champion who had defeated Williams at the US Open in September, had been upset earlier in the day. It was an opportune, if not perfect, time for Williams to make her way to the final and finally tie Margaret Court’s record of 24 major titles.

Rybakina had other plans.

The 21-year-old, who was playing in the fourth round at a major for the first time, relied on her serve, powerful hitting and unflappable demeanor to pull off the victory. She dominated the first set and held on as Williams raised her level of play in the second — finding a way to break Williams’ serve for the fifth time in the match and closing out the 6-3, 7-5 victory.

Williams shook her head and sighed as she made her way to the net to congratulate her opponent. Her quest to add her name to the history books was put on hold yet again.

After winning her first three matches in straight sets, it was a disappointing result for Williams, though not entirely unexpected. The 39-year-old had gone nearly three months without playing a match following her emotional exit in the semifinals at the Australian Open, further prompting questions about whether her time in the sport was nearing its end. When she finally returned at the Italian Open last month, she lost in her opening-round match.

She didn’t fare much better in Parma, recording her only victory against a 17-year-old playing in her first career WTA match, before falling in the next round. She wasn’t feeling optimistic about the state of her game before the tournament got underway.

“I’m in a much better place than when I got here,” Williams said Sunday. “You know, just literally trying to win a match, because it had been a really difficult season for me on the clay. And although I love the clay, I was, like, if I could just win a match. Yeah, that’s kind of where I was kind of coming in.”

So while the early exits of other big-name players in her half of the draw were beneficial for her chances, and added to the external expectations, Williams gave no indication she believed she was a contender for the title. Clay has always been her weakest surface, having won just three of her major titles at Roland Garros, and her 2021 run marked her best result at the event since 2018.

“Even with the loss today, after her miserable lead-up on clay, she should be feeling really good about making the round of 16,” said Pam Shriver, the 21-time major doubles champion and ESPN analyst. “I was encouraged by a lot of things I saw from her throughout the tournament — her serve looked good, her sliding and hitting into the ball, the way she played many of the longer rallies. The overall attention to detail showed she’s still in it.”

And now, with a few wins under her belt and an extra week to prepare, an increasingly confident Williams will turn her attention to Wimbledon — the site of seven of her Grand Slam victories, most recently in 2016.

Williams has made the last two finals at the All England Club — including just months after returning from childbirth in 2018. She lost both finals in straight sets, to Angelique Kerber and Simona Halep, respectively, but was dominant throughout both tournaments leading into the title match. She dropped just one set en route to the 2018 final.

It has been two years since Williams, or most of her peers, have played on grass following the cancellation of the 2020 tournament due to the pandemic. This could only help her even more, according to Shriver.

“Wimbledon was always going to be a better surface for her and a place where she had a better chance to make a run,” Shriver said. “There’s an advantage this year more than ever for her because she’s played so much on grass during her career, while the younger players are really going to be lacking the experience.”

With three weeks until the start of the tournament, Williams was uncertain on Sunday whether she would play in any of the grass court events before Wimbledon. She said she was considering going home to Florida and regrouping for a few days before making the trip to London instead. But if she wanted to play in any of the four remaining tournaments, she could almost certainly receive a wild card for entry.

When asked Sunday if she had just played in her final match at Roland Garros, Williams said she wasn’t thinking about that now. Whether she privately knows the answer or is still uncertain about her long-term future, her window to tie the record is inevitably closing. Wimbledon might just be her opportunity to do it.

“I hope she’s not looking at it like this, but I think this is her last chance,” Shriver said. “There are too many great players on hardcourts now for her to win there. But at Wimbledon, on the grass surface, where she’s so comfortable and so many won’t be, it really plays into Serena’s hands.”