Roger Federer is going to be sidelined for what he said will be "many months" because he needs a third operation on his right knee, a procedure he said will leave him with "a glimmer of hope" that he can return to competition.

"I've been doing a lot of checks with the doctors, as well, on my knee, getting all the information, as I hurt myself further during the grass-court season and Wimbledon," Federer said.

Federer, 40, who has 20 Grand Slam singles titles to share the men's record with Rafael Nadal and Novak Djokovic, acknowledged there was a chance his playing career could be over, but he said he would rehab the knee with the goal of making another comeback.

Federer missed more than a year of action after first having his knee repaired shortly after the 2020 Australian Open in February of that year. He had a follow-up procedure that June.

Federer won 16 of his Grand Slam titles between 2003 and 2010 but remained at or near the top of the sport into his late 30s.