Morocco, the 2004 African Nations Cup finalists, bowed out of this year's tournament tonight after drawing 0-0 with Libya in their final Group A game.
Egypt's 3-1 win over a reshuffled Ivory Coast side already in the quarter-finals put the host nation through, while Morocco fell at the first hurdle with just two points on the board.
Morocco's hopes of going through rested on a defeat for Egypt, playing a few kilometres away at Cairo's International Stadium, and a victory over Libya. The Moroccans failed even to do their part against some dogged Libyan defending.
Libya, already eliminated after two consecutive defeats, at least got a point from a scrappy game at the Military Stadium to show for their efforts in Egypt.
Both sides created early chances but Libya's Nader Kara failed to hit the target after being put through and Noureddine Naybet's scuffed effort at the far post flew wide from Youssef Safri's free kick.
Morocco midfielder Mohamed Yaacoubi was unlucky, though, with a low shot from the edge of the area that struck the base of the post with Libya's Uruguayan-born keeper Luis de Agustini stranded.
All the pressure was coming from the Moroccans, anxious to keep their qualifying chances alive against a Libya side clearly out to catch them on the break.
There was no change after halftime as Morocco strung together breaks down both flanks but failed to get in any decent crosses and got nothing from their corners.
Morocco's last chance in the closing stages came and went with a low shot by substitute Ali Boussabon that De Agustini gathered at his near post.
Libya's Marei Ramli broke clean through in search of an improbable victory but the midfielder skied his shot over the bar with only Moroccan keeper Tarek Jarmouni to beat.