South Africa have suffered a major embarrassment as they failed to qualify for the Africa Cup of Nations finals.
Sudan defeated Bafana Bafana 2-0 in Khartoum to clinch a place in the finals at their visitors' expense.
Saifeldin Maki and Mohamed Abdel Rahman scored the first-half goals.
Sudan qualified for only the third time in 23 attempts, finishing second in Group C behind Ghana, who won 3-1 at home to Sao Tome e Principe.
It was a major setback for South Africa, who needed at least draw but were defensively undone by their determined hosts.
Maki scored from a fifth-minute set piece while Rahman's mazy run down the left ended with an angled shot into the back of the net in the 31st minute.
Sudan are the 18th team to book a place at next January's finals in Cameroon, with the remaining six berths to be decided in the last round of qualifiers on Monday and Tuesday.
Ghana topped the group with 13 points after they beat the island minnows.
Nicholas Opoku scored first for Ghana followed, on the half hour, by Jordan Ayew.
Baba Rahman extended the lead on the hour mark but Sao Tome pulled one back late through Jokceleny Carvalho.
Tunisia finished their Group J campaign unbeaten, registering a fifth win in six games as they edged Equatorial Guinea 2-1 at home.
After Seifeddine Jaziri had given them a fourth minute lead, Tunisia were guilty of poor finishing and only extended their advantage when Carlos Akapo turned the ball into his own net in the 52nd minute.
Tunisia substitute Firas Chaouat returned the favour two minutes from time to give the visitors a consolation goal.
Tanzania, who finished third in the group, condemned Libya to bottom place as Simon Msuva's goal just before halftime separated the two sides in their clash in Dar-es-Salaam.
Namibia, who were already eliminated, came from behind to beat already-qualified Guinea 2-1 in Windhoek with two headed goals from captain Peter Shalulile.
Mamadou Kane had given Guinea an 18th minute lead in the Group A game.