(CNN) -- Graeme Smith has led South Africa to the top of the rankings, but Monday he made the shock announcement he would quit international cricket at the completion of their current Test match against Australia in Cape Town.
The 33-year-old Smith has captained South Africa in 108 Test matches and played 347 games for his country in all forms of the game, scoring over 17,000 runs from the opener position.
South Africa are currently No.1 rated in Test cricket, but are facing a series defeat to resurgent Australia, with the series tied at 1-1 going into the game at Newlands.
Smith was dismissed for just five runs on the third day with Mitchell Johnson and Ryan Harris bowling Australia into a winning position.
At the end of the day's play he broke the news to his teammates. "This has been the most difficult decision I have ever had to make in my life," said Smith.
"It's a decision that I have been considering since my ankle surgery in April last year.
"I have a young family to consider, and I felt that retiring at Newlands would be the best way to end it because I have called this place home since I was 18 years old."
South Africa are having to cope without record run scorer Jacques Kallis, who quit Tests earlier this year although he will carry on playing in one-day internationals.
A stunned Cricket South Africa (CSA) chief executive Haroon Lorgat praised Smith's contribution.
"Although Graeme's decision to retire from all forms of international cricket comes as a surprise to all of us, we must respect him for deciding to call time," he said.
"Knowing him as well as I do, having been instrumental as a selector in appointing him as a young captain, he would not have taken this decision lightly or without a great deal of thought.
"He has captained the Proteas for more than a decade and will draw a lot more satisfaction from the fact that he leaves our Test team at the top of the world and in such good health rather than from all the personal records he has achieved as the longest-serving captain the game has seen in the demanding Test format."
Smith, who is set to continue playing cricket with English county side Surrey this summer, said he would reflect on his career with pride.
"I have always been someone who has left everything out there on the field for my team and for my country. I'm extremely honored and proud to have had the privilege to lead so many wonderful players.
"I thank and honor the players who I have played with and those who have supported me and helped me to be the person and captain I am today."
Smith will get one more chance to add to his tally with the bat with an uphill struggle to salvage a draw.
Australia lead by 234 runs at the end of the third day with 98 overs set to be bowled on each of the final two days after bad weather on the second day.
He is likely to receive a warm welcome as he makes his international farewell, looking to add to his 9,262 Test runs at an average of nearly 49 runs per innings.
Smith has also played 197 ODIs, averaging almost 38, and 33 Twenty20 Internationals.
He is the latest leading figure in world cricket to announce their retirement, with Indian maestro Sachin Tendulkar quitting at the end of last year and Kallis calling it a day before the series against Australia.