Tennis legend Roger Federer is set to undergo knee surgery and faces 'many months' recovering with his professional tennis career on the line.

The Swiss icon, 40, hopes the operation will give him a chance of competing again at the level he’s capable of, but he faces an uphill battle due to his ever-increasing age. Something he is very aware of.

Federer revealed the news to his 8.6 million followers on Instagram, saying: "I just wanted to give you a bit of an update [on] what’s been going on since Wimbledon. As you can imagine, it's not been simple.

"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.

"I’ll be on crutches for many weeks and also out of the game for many months, so it’s going to be difficult of course 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 and I want to give myself a glimmer of hope to return to the tour in some shape or form.”

Federer will now, unfortunately, miss the US Open, which is due to start on August 30, and it seems increasingly unlikely that he'll be fit enough for the Australian Open in January.

Federer hasn’t featured on a tennis court since his loss in the quarter-finals at Wimbledon in July at the hands of Hubert Hurkacz, resulting in the Swiss national missing the Tokyo Olympics.

The sporting icon is one of the greatest to ever play the sport of tennis, winning a joint-record 20 Grand Slam men's singles titles during his illustrious career, level with longtime rivals Rafael Nadal and Novak Djokovic.

Federer has already defied his age multiple times in recent years, winning the Australian Open and becoming the oldest world no.1 in history in 2018.

p1fd7b4g1v1mh11h001een1noq1iprj.jpg

He stated: "I am realistic, don’t get me wrong. I know how difficult it is at this age right now to do another surgery and try it.

"But I want to be healthy, I will go through the rehab process I think also with a goal while I’m still active, which I think is going to help me during this long period of time."

We can only hope that we see Federer back on the court soon, fighting for Grand Slams, and when the time comes, he can bow out of his tennis career on his own terms, and not those of a doctor.