South Africa wicketkeeper-batsman Quinton de Kock retired from test cricket on Thursday in a shock move announced just a few hours after he played in the defeat to India in the first test in Centurion.

In a statement, the 29-year-old de Kock said he made his decision in order to have more time to spend with his family. De Kock and his wife Sasha are expecting their first child in the coming days.

"This is not a decision that I have come to very easily," de Kock said. "I have taken a lot of time to think about what my future looks like and what needs to take priority in my life now that Sasha and I are about to welcome our first child into this world and look to grow our family beyond that.

"My family is everything to me and I want to have the time and space to be able to be with them during this new and exciting chapter of our lives."

De Kock said he was still "fully committed" to playing limited-overs cricket for South Africa and signed off his statement with: "See you in the ODIs and T20s."

His move seemingly took Cricket South Africa by surprise, too. Its CEO, Pholetsi Moseki, said: "It's sad to lose a player of Quinton's caliber at what we still see as the prime of his career."

De Kock made his debut against Australia in 2014 and played 54 tests, sometimes balancing the responsibility of opening the batting and keeping wicket, and later leading the team as captain. He made six test centuries with his best score, 141 not out against West Indies this year, underlining the fact that he was still one of South Africa's leading batters. His test average is 38.82.

He took 221 catches in tests, with 11 stumpings.

De Kock had spoken previously of the toll test cricket had taken on his personal life, especially in the pandemic era when players must often stay in bio-bubbles during long series, not allowed to leave team hotels except for matches and training sessions and not allowed to be with family and loved ones.

He took a break from all cricket at the start of this year for mental health reasons, citing the "unsettling" effect of being in those coronavirus bio-bubbles.

De Kock also made headlines at the Twenty20 World Cup in October when he refused to play in a game after Cricket South Africa ordered all its players to take a knee for the Black Lives Matter movement. De Kock apologized and took a knee in later games but said he felt forcing players to perform the anti-racism gesture undermined its significance.

South Africa lost the first test against India by 113 runs earlier Thursday to go 1-0 down in the three-test series. De Kock was already set to miss the rest of the series for the birth of his child but had given no public indication that he was about to quit test cricket for good.

"I love test cricket and I love representing my country and all that it comes with," he said in his statement. "I've enjoyed the ups and the downs, the celebrations and even the disappointments, but now I've found something that I love even more.

"In life, you can buy almost everything except for time, and right now, it's time to do right by the people that mean the most to me."