Updated

Roger Federer, one of the most accomplished tennis athletes of all time, announced he’s retiring after more than two decades and 20 Grand Slam singles titles.

Federer, 41, posted a letter to fans on his social media to make the announcement. He cited injuries over the last few years as a reason to step away. He last won a Grand Slam in 2018 – the Australian Open.

"As many of you know, the past three years have presented me with challenges in the form of injuries and surgeries. I have worked hard to return to full competitive form. But I also know my body’s capacities and limits, and its message to me lately has been clear. I am 41 years old. I have played more than 1500 matches over 24 years. Tennis has treated me more generously than I ever would have dreamt, and now I must recognize when it is time to end my competitive career.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Roger Federer at Laver Arena in 2020

Roger Federer waves as he leaves Rod Laver Arena following his loss to Novak Djokovic at the Australian Open in Melbourne, Jan. 30, 2020. (AP Photo/Lee Jin-man)

Federer said the Laver Cup next week would be his final ATP event and he will no longer play any Grand Slams or tour events.

"This is a bittersweet decision, because I will miss everything the tour has given me. But at the same time, there is so much to celebrate. I consider myself one of the most fortunate people on Earth. I was given a special talent to play tennis, and I did it all at a level that I never imagined, for much longer than I ever thought possible."

Federer thanked his wife, family, fans and sponsors for supporting him.

"The last 24 years on tour have been an incredible adventure. While it sometimes feels like it went by in 24 hours, it has also been so deep and magical that it seems as it I’ve already lived a full lifetime. I have had the immense fortune to play in front of you in over 40 different countries. I have laughed and cried, felt joy and pain, and most of all I have felt incredibly alive. Through my travels, I have met many wonderful people who will remain friends for life, who consistently took time out of their busy schedules to come watch me play and cheer me on around the globe. Thank you.

SERENA WILLIAMS TEASES TENNIS COMEBACK AFTER RECENT RETIREMENT: 'TOM BRADY STARTED A REALLY COOL TREND'

Roger Federer at 2021 Wimbledon

Roger Federer plays a return to Hubert Hurkacz at Wimbledon in London, July 7, 2021. (AP Photo/Kirsty Wigglesworth, File)

"When my love of tennis started, I was a ball kid in my hometown of Basel. I used to watch the players with a sense of wonder. They were like giants to me and I began to dream. My dreams led to me work harder and I started to believe in myself. Some success brought me confidence and I was on my way to the most amazing journey that has led to this day.

"So, I want to thank you all from the bottom of my heart, to everyone around the world who has helped make the dreams of a young Swiss ball kid come true.

"Finally, to the game of tennis: I love you and will never leave you."

Federer’s announcement comes a few weeks after Serena Williams announced her retirement.

Federer was one of the most dominant tennis players in his era and had some epic matchups with Andy Roddick, Rafael Nadal and Novak Djokovic when they were coming through the ranks. At one point, he had won four consecutive U.S. Open titles.

He also added a gold medal in Olympic doubles in 2008 and a silver in singles in 2012.

But over the last few seasons, Federer has been hampered by injuries. He didn’t play any pro events in 2022 and only competed in 19 matches from 2020-2021. His last tournament title came in 2019 at the Swiss Indoors Basel.

Roger Federer waves

Roger Federer waves after defeating Tennys Sandgren at the Australian Open in Melbourne on Jan. 28, 2020. (AP Photo/Lee Jin-man, File)

CLICK HERE TO GET THE FOX NEWS APP

Federer will walk away with 1,251 wins and 103 singles titles.