Libya beat Morocco 3-0 in Tripoli to qualify on 4-3 aggregate for the Championship of African Nations (CHAN) in February in Ivory Coast.
Elsewehre, Tanzania recorded a double over Sudan by winning 2-1 in the second leg match away from home.
They won their first encounter 3-1 at home and thus advance to the final tournament in Ivory Coast on 5-2 aggregate to qualify for a senior African tournament for the first time in 28 years.
Libya lost to Morocco 3-1 in their first leg clash only to turn things around in a spirited fightback. Mohamed Zaabia opened the scoring for the home side after 18 minutes before Ahmed al-Zawi doubled Libya's lead two minutes into the second half.
Ahmed Sadd then made victory certain for The Greens with a 61st minute strike.
The victory was a consolation of sorts for Libya's Tunisian coach, Faouzi Benzarti, after his team narrowly missed out on the next round of the qualifying tournament for the 2010 World Cup and Africa Cup of Nations, despite finishing on same points as Ghana and Gabon.
Zambia also confirmed their place for the maiden edition of the CHAN by edging past Angola 3-1 on aggregate after they won their second leg clash 2-1 at the Konkola Stadium in Kitwe.