Roger Federer withdrew from the French Open on Sunday after winning through to the fourth round, citing a desire not to rush his return from injury.
The 39-year-old Swiss prevailed 7-6 (7-5), 6-7 (3-7), 7-6 (7-4), 7-5 over Dominik Koepfer on Saturday night.
It was the longest match he has played in 18 months, following double knee surgery.
The contest lasted three hours and 35 minutes.
The 20-time grand slam winner has played few tournaments over the past 18 months and said a need to rest his body was behind his decision to withdraw.
In a statement released by the French Open, Federer said: “After discussions with my team, I’ve decided I will need to pull out of Roland Garros today (Sunday).
“After two knee surgeries and over a year of rehabilitation, it’s important that I listen to my body and make sure I don’t push myself too quickly on my road to recovery.
“I am thrilled to have gotten three matches under my belt. There is no greater feeling than being back on court.”
Tournament director Guy Forget said: “The Roland Garros tournament is sorry about the withdrawal of Roger Federer, who put up an incredible fight last night.
“We were all delighted to see Roger back in Paris, where he played three high-level matches. We wish him all the best for the rest of the season.”
Federer entered the clay-court major with a 1-2 win-loss record for the year, most recently losing to Pablo Andujar in Geneva last month, and little was expected from him.
However, three wins on the spin showed he is not finished yet at the highest level.
His withdrawal suggested he wants to preserve himself for Wimbledon, which starts at the end of the month.
Federer had been due to play ninth seed Matteo Berrettini in the last 16 on Monday.