Roger Federer announced on Tuesday he has withdrawn from the upcoming Tokyo Olympics after a “setback” with his recovery from a knee injury.

The 20-time Grand Slam champion was knocked out of Wimbledon in the quarter-finals by Hubert Hurkacz last week.

“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,” Federer said in a statement on social media.

The tennis competitions in Japan are set to start on July 24, the day after the opening ceremony.

Federer, who turns 40 next month, pulled out of the French Open after reaching the fourth round, hoping to get fit for Wimbledon. He showed signs of his best during his run to the quarter-finals, but bowed out tamely, losing 6-3, 7-6 (7/4), 6-0 to Poland’s Hurkacz.

That defeat sparked talk among fans and pundits speculating whether the eight-time Wimbledon winner would retire, with Federer saying he “didn’t know” if his Wimbledon career was over.

But on Tuesday, the former world number one said he was hoping to return to the ATP Tour later this summer.

“I have already begun rehabilitation in the hopes of returning to the tour later this summer,” he added. “I wish the entire Swiss team the best of luck and I will be rooting hard for the team from afar.”

He is just the latest to join a long list of tennis stars to skip the Olympics.

Rafael Nadal, Serena Williams and Dominic Thiem have all pulled out, while newly-crowned Wimbledon champion Novak Djokovic put his chances of playing in Tokyo at “50/50”.

The Games have been badly affected by Covid. The 2020 edition was delayed by a year and although it will go ahead, it will largely be held behind closed doors and with strict health restrictions in place.