Cape Town - When Michael Phelps won the 4x100m individual medley in the pool in Rio for an incredible 23rd Olympic gold medal, he tied South Africa's all-time tally.
GALLERY: 10 highlights from Wayde van Niekerk's 400m victory
But thanks to Wayde van Niekerk, South Africa have retaken the lead...
Phelps, the greatest Olympian of all time, retired following his five golds and one silver in Rio, giving him a final overall Olympics medal tally of 23 golds, three silvers and two bronzes.
Heading into the Rio Games, South Africa, in their previous 18 Olympic appearances dating back to 1904, had won 23 gold medals.
But cometh the hour, cometh the man, and Van Niekerk delivered a 24th gold for South Africa in sensational fashion on Sunday night in Brazil.
South Africa 24, Michael Phelps 23...
South Africa's Olympic gold medal winners:
1904
None
1908
Reggie Walker - 100m
1912
Ken McArthur - Marathon
Rudolph Lewis - Individual Time Trial (cycling)
Harold Kitson / Charles Winslow - doubles (tennis)
Charles Winslow - singles (tennis)
1916
None
1920
Bevil Rudd - 400m
Clarence Walker - bantamweight (boxing)
Louis Raymond - singles (tennis)
1924
William Smith - bantamweight (boxing)
1928
Sydney Atkinson - 110m hurdles
1932
Lawrence Stevens - lightweight (boxing)
David Carstens - light-heavyweight (boxing)
1948
Gerald Dreyer - lightweight (boxing)
George Hunter - light-heavyweight (boxing)
1952
Esther Brand - high jump
Joan Harrison - 100m backstroke
1996
Josia Thugwane - marathon
Penny Heyns - 100m breaststroke
Penny Heyns - 200m breaststroke
2004
Lyndon Ferns / Ryk Neethling / Roland Schoeman / Darian Townsend - 4x100m freestyle relay
2012
Sizwe Ndlovu / Matthew Brittain / John Smith / James Thompson - lightweight four (rowing)
Cameron van der Burgh - 100m breaststroke
Chad le Clos - 200m butterfly
2016
Wayde van Niekerk - 400m
Michael Phelps' 23 gold-medal winning events:
Athens 2004
100m butterfly
200m butterfly
200m individual medley
400m individual medley
4x200m freestyle relay
4x100m medley relay
Beijing 2008
200m freestyle
100m butterfly
200m butterfly
200m individual medley
400m individual medley
4x100m freestyle relay
4x200m freestyle relay
4x100m medley relay
London 2012
100m butterfly
200m individual medley
4x200m freestyle relay
4x100m individual medley
Rio 2016
200m butterfly
200m individual medley
4x100m freestyle relay
4x200m freestyle relay
4x100m medley relay