Morocco beat Libya 4-0 in Thursday's Northern Zone 2016 CHAN qualifier to send themselves and Tunisia through to next year's finals in Rwanda.
Libya had needed to win the match to stand a chance of going through having been beaten 1-0 by Tunisia on Monday.
Morocco are top of the three-team mini-league with seven points and Tunisia in second with four points.
The pair go head-to-head in the group's final match on Sunday, with Tunisia enjoying home advantage in Rades.
Morocco's goals against Libya were scored by Abdessalam Ben Jelloun, Abdessalad Lmobarakay, Rachid Housni and Mohammed Onajem.