Roger Federer is sitting out the rest of this season, including the Rio de Janeiro Olympics and U.S. Open, to protect his surgically repaired left knee.

Federer wrote on his Facebook page Tuesday that he needs "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," Federer said.

The owner of a record 17 Grand Slams titles turns 35 on Aug. 8, so the reference to "another few years" might give his fans increased hope of seeing Federer continue to wield a racket for quite some time.

His agent, Tony Godsick, wrote in an email to The Associated Federer is the first member of tennis' so-called "Big 4" -- a group that also includes No. 1-ranked Novak Djokovic, 14-time major champion Rafael Nadal and 2012 gold medalist Andy Murray -- to pull out of the Rio Games, where that sport's competition starts on Aug. 6, a day after the opening ceremony.

Federer often has spoken about how much the Olympics mean to him, in part because he met his wife, Mirka, when both were athletes at the 2000 Sydney Games. Federer won a silver medal in singles for Switzerland four years ago in London, and he teamed up with Stan Wawrinka to win a gold medal in doubles at the 2008 Beijing Olympics.

In Brazil, Federer was expected to play singles, doubles with Wawrinka, and mixed doubles with Martina Hingis.

He is the second big draw who will be missing from the Rio tennis tournament: Five-time major champion Maria Sharapova won't be there because she is serving a two-year doping ban.

The arthroscopic procedure Federer had on his knee in February, repairing torn cartilage, was the first operation of his lengthy and accomplished career. Federer said he got hurt while preparing a bath for his twin daughters.

He's also had back issues this season, missed the French Open to end his record 65-appearance streak at major tournaments, and did not win a title of any sort in 2016 -- making it the first year since 2000 that he will finish without at least one trophy.

So after participating in every single Grand Slam tournament from the 2000 Australian Open through the 2016 Australian Open, Federer will be sitting out two of the last three this year. He is a five-time champion at the U.S. Open and was the runner-up there to Djokovic last year.

Federer, who has spent more weeks at No. 1 than anyone in the history of the ATP computerized rankings, currently sits at No. 3, having gone 21-7 this season. Depending on how other players fare, of course, Federer's ranking will tumble over the course of the rest of the year.

He hasn't played since losing to Milos Raonic in the Wimbledon semifinals early this month. Federer fell awkwardly during that match, winding up face-down on the Centre Court grass, and had a trainer come out to check on his left knee afterward.

Federer said at the time he wasn't sure how badly he might have been injured.

In his statement Tuesday, Federer wrote: "The silver lining is that this experience has made me realize how lucky I have been throughout my career with very few injuries."

And he added: "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."