The 20-time grand slam champion announced last week that he would bring his professional tennis career to a close after the Laver Cup that starts in London on Friday.
Federer, whose most recent competitive match was a loss to Hubert Hurkacz in last year’s Wimbledon quarter-finals, has been struggling with a knee problem.
And the 41-year-old Swiss told BBC Breakfast: “The last three years have been tough to say the least.
“I knew I was on very thin ice for the last year, ever since I played Wimbledon. I tried to come back but there was a limit to what I could do. And I stopped believing in it, to be honest”
Federer said that after a scan a few months ago, “very quickly we realised this was it”, adding: “Then the question becomes: how do you announce and when do you announce? This is when it becomes reality. It was OK but stressful.”
Looking to the future, Federer said the immediate plan in retirement is a holiday with his family, and that while he still has to “figure things out a little bit”, he would “love to always mentor children and get a new Swiss superstar going”.
He added: “If I can help the federation a little bit here and there, you know, I can see those things.
“I love this game and I want to stay involved in some shape or form. I won’t be a ghost or a stranger.”
Federer says he is “totally happy to step away” from playing professionally having “totally overachieved in my mind” during his illustrious career.
And speaking about rivals Rafael Nadal and Novak Djokovic, who have 22 and 21 grand slam singles titles respectively, and Andy Murray, he said: “All of a sudden there was this beautiful mix, we’re all winning for 10 plus years, all the same tournaments, almost nobody else could win anything else. It was like a lock on the big tournaments.
“So I think, also for the fans, it’s been a joy to watch, and I’m sure some fans will be sad I’m leaving, of course, but then again, there will always be wonderful new people.”