Roger Federer says he will be out for "many months" as he prepares to have surgery he hopes will resolve a persistent knee issue.
The 20-time Grand Slam champion had two knee operations last year and missed out on the Olympic Games in Tokyo due to injury.
Federer says he hopes the surgery will give him "a glimmer of hope" of returning.
The 40-year-old was beaten at the quarter-final stage of Wimbledon this summer and has slipped to ninth in the world rankings.
Following his defeat to Poland's Hubert Hurkacz, Federer admitted he was unsure whether he would play at the English tournament again due to his condition.
In the last 10 months, Rafael Nadal and Novak Djokovic have each matched his 20 titles.
He withdrew from the French Open in July despite winning his third-round match as tennis fans grew worried of a potential retirement.
But in a video posted on his Instagram page on Sunday, Federer said: "I'll be on crutches for many weeks, and also out of the game for many months.
"It's going to be difficult in some ways but, at the same time, I know it's the right thing to do because I want to be healthy, I want to be running around later as well again."
"I also want to give myself a glimmer of hope to return to the tour in some shape or form."
The Swiss acknowledged that a third operation in two years is no guarantee of a return but he is determined to fight.
Can Federer get back to his best at 40? Comment your thoughts below.
"I am realistic - I know how difficult it is at this age right now to do another surgery and try it," he explained.
"But I want to be healthy.
"I will go through the rehab process with a goal, while I'm still active, which I think is going to help me during this long period of time."
Federer also explained the circumstances which led to his decision, admitting a short-term outlook is no way to continue after turning 40 last week.
"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.
"That's just not the way to go forward, so unfortunately, they told me for the medium to long term to feel better, I will need surgery. I decided to do it."
It means he will not be available for the season's final Grand Slam, the US Open.
The competition begins in New York on Monday, August 30.