JP Duminy has retired from Test cricket with immediate effect. Duminy played 46 Tests from December 2008 to July 2017, scored six centuries, bowled occasional offspin to claim 42 wickets and will finish with a batting average of 32.85.

He was dropped from the starting XI after the Lord's Test in July - the first of a four-match series - sent home from the tour after the second match and opted out of the opening round of first-class matches, which starts on Tuesday, heightening speculation his long-form career was over. On Saturday, Duminy released a statement confirming his intention to focus on limited-overs cricket in future.

"After long and careful deliberation, I have decided to retire from first-class and Test match cricket with immediate effect. I have thoroughly enjoyed the privilege and opportunity to represent my country in 46 Tests and the Cape Cobras in 108 first-class matches overs the past 16 years. It is an experience that cannot be replaced and one I will always cherish. Test cricket has always been the pinnacle and I've been fortunate enough to experience some memorable highlights with the Proteas and also in first-class matches with the Cape Cobras. "In recent years I have been privileged to be a senior member and custodian of a special team environment and culture which has made me very proud," Duminy's statement read. "In the years ahead, my focus will be placed on attaining limited-overs cricket success for South Africa and the Cape Cobras, along with attending to my young family, who have been incredibly supportive and understanding."

Although Duminy's focus will be on white-ball cricket, he has offered his services to the Cobras as a mentor in the first-class format and already started the job. Duminy was part of the franchise's pre-season preparations in Oudtshoorn and will continue to be around the squad as the summer kicks off. "There are many talented youngsters coming through our domestic system and I would love to help where I can. I've had the privilege of working with the squad in this role over the last two weeks and I have thoroughly enjoyed it," Duminy said.

But Duminy will also have a busy playing schedule of his own. South Africa's focus is firmly on the 2019 World Cup and Duminy will be expected to play in all of the matches in the lead-up to that tournament, starting with a series against Bangladesh in October. He will also feature prominently in the Global T20, which starts on November 3. Duminy will captain the Cape Town Knight Riders and, after opting out of the IPL last season to concentrate on his international career, has spoken of a return to the Indian twenty-over tournament as well.

Still, Duminy will likely be best remembered for the impact he made in his maiden Test series against Australia in 2008. On debut in Perth, Duminy struck an unbeaten half-century and was involved in an unbroken 111-run stand for the fifth wicket with AB de Villiers to help South Africa run down a target of 414 - the second-highest successful run-chase in Test cricket. In the next match, the Boxing Day Test, he made 166 - his highest in Tests - to carry South Africa from 251 for 8 to 459 and on their way to a series victory.

The glory was shortlived and Duminy was dropped in February 2010, after 12 Tests. He came back into the side in March 2012, as a replacement for the injured Jacques Kallis, and scored a century in Wellington and remained in the side for South Africa's tour to England in 2012, where he was tasked with batting at No.7. He had an important say in South Africa taking the Test mace off England though, with 61 in the first innings at Lord's.

On his return to Australia, Duminy ruptured his Achilles' tendon on the first day of the first Test In Brisbane and was sidelined for almost a year before making a return against Pakistan in the UAE. Duminy scored his third century against Australia in Port Elizabeth in February 2014 and fourth against Sri Lanka in Galle later that year but hit another lean patch and was dropped for a second time, during South Africa's series against England in early 2016. He responded with a double-hundred for the Cobras and was immediately back in the side, with a promotion to No.4.

In his third stint, Duminy scored a century against Sri Lanka in Johannesburg but had little else to show. He had gone eight innings with a top-score of 39 and appeared completely bereft of confidence, when was dropped again. At the time, Test captain Faf du Plessis said Duminy could play Tests again "if he wants to," but "obviously he has a long way back." Duminy has decided that way was too long.

South Africa have an automatic replacement for Duminy in the Test team. AB de Villiers had made himself available to play Tests again after a year-long sabbatical from the format but they will have to wait until at least December. De Villiers has not put himself into contention to play the Bangladesh series, which starts on September 28. Instead, that will be an opportunity for someone else to establish themselves in the side. Temba Bavuma is the most recent No.4 and has the temperament to stay there but another option is Theunis de Bruyn or even David Miller, who played for the South African A side against India A last month.

Firdose Moonda is ESPNcricinfo's South Africa correspondent