Hosts Morocco finished top of Group A at the African Nations Championship despite having a penalty saved and being held to a goalless draw by Sudan.
Achraf Bencharki had his second-half penalty saved and, despite dominating, Morocco could not find a way past Akram El Hadi Salim in the Sudan goal.
Guinea salvaged some pride at the tournament for locally-based players with a 1-0 over Mauritania.
The only goal was scored by captain Ibrahima Sory Sankhon after 15 minutes.
Morocco, who made 10 changes from their win over Guinea, created chances right from the start of their top-of-the-table decider against Sudan, with Bencharki lifting the ball just over after only two minutes.
The Moroccans should have taken the lead in the 48th minute when Walid El Karti was fouled in the area by Bakri Bachir but Akram guessed the right way and pushed aside Bencharki’s spot-kick.
Akram also made a good save from a Jawad El Yamiq header after 73 minutes, while Ayoub El Kaabi fired a shot just wide of the post as he looked to score his sixth goal of the tournament.
Sudan tried to create chances when given the chance, with second-choice keeper Abdelaali M’Hamdi forced to make a few smart saves.
In the other match, both Mauritania and Guinea went into their game knowing they could not qualify.
Sankhon was set up for his goal by Daouda Bangoura, who slipped the ball to his captain inside the area for him fire a low shot into the far corner.
Four minutes later it could have been two but a fierce shot from Jean Charles Fernandez was deflected on to the post.
Mauritania’s best chance came two minutes after the break, when two onrushing players managed to miss El Moustapha Diaw’s cross with the goal wide open.
They played some of their best football of the tournament in the second half, with Bagili Babacar creating a few chances for Mauritania to score their first goal of the finals.
Guinea also had chances to increase their lead but they were squandered, with Saibdouba Bissiri Camara missing just past the post and then firing straight at the keeper.
The results mean Morocco finish ahead of Sudan on goal difference after they both ended the group stage on seven points. Guinea are third with three and Mauritania bottom without a point.
Morocco and Sudan must wait to see how Group B finishes to find out who they face in Saturday’s quarter-finals. Namibia and Zambia play each other on Monday to decide the winner of that pool.