Roger Federer has pulled out of the Rio 2016 Olympics and ended his season ©Getty Images

Tennis superstar Roger Federer has pulled out of next month's Olympic Games in Rio de Janeiro due to knee problems.

The 34-year-old Swiss, a winner of 17 Grand Slam singles titles, said doctors had advised him to bring his season to an end after he underwent surgery earlier this year.

It means he will also miss the last Grand Slam of the year, the US Open next month, while it is also likely to mean that he will end his career without an Olympic gold medal in singles.

The 34-year-old won the men's doubles gold with Stan Wawrinka at Beijing 2008 and then earned singles silver after losing to Britain's Andy Murray in the final of London 2012.

As well as playing in the singles, Federer planned to enter the Rio 2016 mixed doubles with compatriot Martina Hingis, while it had not yet been confirmed if he would team up with Wawrinka again.

Switzerland's Roger Federer, right, won an Olympic gold in the doubles with Stan Wawrinka at Beijing 2008 ©Getty Images
Switzerland's Roger Federer, right, won an Olympic gold in the doubles with Stan Wawrinka at Beijing 2008 ©Getty Images

"I’m extremely disappointed to announce that I will not be able to represent Switzerland at the Olympic Games in Rio and that I will also miss the remainder of the season," said Federer, his country's flagbearer at Beijing 2008.

"Considering all options after consulting with my doctors and my team, I have made the very difficult decision to call an end to my 2016 season as I need more extensive rehabilitation following my knee surgery earlier this year. 

"The doctors advised that if I want to play on the ATP World Tour injury free for another few years, as I intend to do, I must give both my knee and body the proper time to fully recover. 

"It is tough to miss the rest of the year. 

"However, the silver lining is that this experience has made me realise how lucky I have been throughout my career with very few injuries. 

"The love I have for tennis, the competition, tournaments and of course you, the fans remains intact. 

"I am as motivated as ever and plan to put all my energy towards coming back strong, healthy and in shape to play attacking tennis in 2017.

"Thanks for your continued support."