Bafana Bafana drawn with Morocco and Ivory Coast at Afcon
Bafana Bafana will face 1992 and 2015 champions Ivory Coast and 1976 winners Morocco in Group D of the 2019 Africa Cup of Nations (Afcon) finals in Egypt.
Southern African neighbouring country Namibia make up the fourth team pulled from the pot for Group D in Friday night's draw in Cairo for the competition that runs from June 21 to July 19.
Morocco are the highest-placed team in the group in the latest Fifa rankings at 45th in the world and fourth in Africa, Cote d-Ivoire are 65th and 11th, South Africa 73rd and 14th, and Namibia 113th and 28th.
The top two teams from the six groups and four best third-placed finishers reach the last-16.
Morocco should be the danger team in the group. Coach Herve Renard has won two Nations Cups, with unheralded Zambia in 2012 and Ivory Coast in 2015. He restored an underachieving Morocco's fortunes by steering them to the Russia 2018 World Cup finals last year, where they exited in the first round.
Ivory Coast are dealing with life post the golden generation that won the Afcon four years ago in Equatorial-Guinea.
Hosts Egypt were handed a potentially tricky draw along with Democratic Republic of Congo, Uganda and Zimbabwe.
With this the first 24-team Afcon, there was no clear "group of death".
The glitzy draw took place in front of the Spinx and the Pyramids of Giza in Cairo.
Bafana had been placed in Pot 3 of the seedings along with Uganda‚ Benin‚ Mauritania‚ Madagascar and Kenya.
The seedings were determined by a combination of Fifa's global rankings, past performances in Nations Cup finals, and the qualification campaign.
South Africa Football Association (Safa) president Danny Jordaan and Bafana team manager Barney Kujane attended the draw as South African representatives.
Coach Stuart Baxter did not travel despite there being a workshop in the Egyptian capital on Wednesday for all the 24 qualified coaches.
Bafana qualified in second place with 12 points from Group E, where Nigeria won the group with 13 points.
The South Africans beat Nigeria 2-0 away, drawing 1-1 at home. They beat Seychelles 6-0 at home and drew 0-0 away.
SA drew 0-0 against Libya at home, then clinched qualification for Egypt 2019 with last month's 3-1 away victory against the Mediterranean Knights in Tunisia.
Bafana, the 1996 Afcon winners on home soil and 1998 losing finalists, have qualified for their second out of the past three Nations Cups.
They went out in the first round at Equatorial-Guinea 2015 and did not qualify for Gabon 2017.
Since sporting readmission SA have participated in nine finals of the 13 Nations Cups they have entered, achieving third place in 2000.
2019 Africa Cup of Nations Draw -
Group A: Egypt, DR Congo, Uganda, Zimbabwe
Group B: Nigeria, Guinea, Madagascar, Burundi
Group C: Senegal, Algeria, Kenya, Tanzania
Group D: Morocco, Ivory Coast, South Africa, Namibia
Group E: Tunisia, Mali, Mauritania, Angola
Group F: Cameroon, Ghana, Benin, Guinea-Bissau