Hashim Amla faced a stern test of character in his first series as captain after South Africa lost three key wickets against a determined Sri Lankan bowling attack in the second Test on Friday.
Amla, 31, dug in with a painstaking 46 off 134 balls as South Africa trailed the hosts by 323 runs with seven wickets in hand on the second day of the Test at the SSC ground in Colombo.
At stumps, South Africa were 3-98 with AB de Villiers being the other not out batsman at the crease on 11.
Amla is leading the South African team for the first time in this two-Test series after being named captain last month following the retirement of Graeme Smith.
With the wicket showing signs of deteriorating, Amla and his men now face an uphill task to put up a fighting total on the board.
Sri Lanka posted 421 in their first innings, thanks to a solid 165-run knock by Mahela Jayawardene and a defiant 72 by Test debutant Niroshan Dickwella.
South Africa were off to a shaky start in their first innings, losing their openers inside the first nine overs before seamer Suranga Lakmal sent back Faf du Plessis for a fighting 36.
Left-arm spinner Rangana Herath gave the side an early breakthrough when he caught opener Alviro Petersen off his own bowling in the second over for two.
Dean Elgar (one) followed suit, inside-edging off-spinner Dilruwan Perera to short leg where Kaushal Silva dived forward to take a sharp catch.
Amla and du Plessis tried to rebuild the innings with some patient batting but Lakmal broke their 58-run stand half an hour before close.
South Africa lead the two-Test series 1-0 after winning the first match in Galle by 153 runs.