Roger Federer has withdrawn from the Tokyo Olympics because of a setback with his knee problem.

The 39-year-old, who has already had two knee operations, lost to Poland's Hubert Hurkacz in the quarter-finals at Wimbledon.

Federer, runner-up to Andy Murray in the gold medal match at London 2012, said on Twitter: "During the grass court season, I unfortunately experienced a setback with my knee and have accepted that I must withdraw from the Tokyo Olympic Games.

"I am greatly disappointed, as it has been an honour and highlight of my career each time I have represented Switzerland.

"I have already begun rehabilitation in the hopes of returning to the tour later this summer.

"I wish the entire Swiss team the best of luck and I will be rooting hard from afar."

Federer, who turns 40 in August, saw his quest for a ninth Wimbledon singles title ended with a straight-sets defeat for the first time in 19 years.

Wimbledon was the only fifth tournament in 17 months for Federer following two knee operations during 2020.

Meanwhile, British number one Johanna Konta has withdrawn from the Tokyo Olympics after contracting Covid-19 and being unable to train properly.

Konta was ruled out of Wimbledon after a member of her team tested positive and her being deemed as a close contact, so she had to spend 10 days in self-isolation.

The 30-year-old revealed in a statement on Twitter she had subsequently developed symptoms and then also returned a positive test result, which has left her unable to train for the past two-and-a-half weeks.

Konta had played herself into form on the grass by winning her first title for four years in Nottingham.

The British number one then decided to withdraw from tournaments in Birmingham and Eastbourne in order to rest her troublesome knee and ensure she was in prime shape for Wimbledon, only to have her hopes dashed.

"As some of you may know, I was unable to compete at Wimbledon this year after a member of my team tested positive for Covid-19. Unfortunately, whilst self-isolating, I also developed symptoms and subsequently tested positive for the virus," Konta said on Twitter.

"As a result, I have been unable to train for the last two and a half weeks and sadly, this has put my body in a situation where I am unable to ask it to be fully ready in time for the Olympic Games in Tokyo.

"This is a heart-breaking reality for me, as representing Team GB at the Olympic Games in Rio in 2016 is one of my most treasured memories from my career so far.

"I'll be doing my best to get myself back to full health and fitness and ready to be competing again soon.

"During this time, I’ll also be glued to my TV cheering on my fellow Team GB athletes competing in Tokyo and I hope you will all join me."

Follow all the action from Tokyo 2020 with our 24-hour coverage on RTÉ.ie/sport and the RTÉ News app, watch live on RTÉ2 or RTÉ Player and listen to updates and live commentaries on RTÉ Radio.