The African Nations Championship (CHAN) holders Tunisia were eliminated by rivals Morocco in the first qualifying round.
They drew 0-0 with Morocco in Tangier in the second leg, but fell 1-0 on aggregate after
losing at home on 6 July
A last-minute goal from striker Abdessamad Mbarki in Sousse in the first leg proved decisive.
Tunisia - who were big favourites to advance - go out of the competition.
Morocco qualify for the tournament in South Africa in 2014.
Tunisia won the second edition of the tournament for home-based footballers with a 3-0 drubbing of Angola in Sudan two years ago.
Only goalkeeper Farouk Ben Mustapha remained from that title-winning squad to confront the Moroccans.
In other results,
Uganda secured a useful 1-0 away win over Tanzania
in the first leg of their east African derby.
Another first leg qualifier in the east of the continent was equally close with
1-0 in Addis Ababa. Midfielder Asrat Megersa, part of the squad that played at the 2013 Africa Cup of Nations after a 31-year absence, scored on 11 minutes.
The 16-nation tournament is scheduled for 11 January to 1February in South Africa and Morocco will appear at the finals for the first time.
South Africa qualify automatically as hosts and Ghana and Libya have secured places after opponents Benin and Algeria withdrew.