Morocco reached the last 16 of the Africa Cup of Nations with a 1-0 victory over Ivory Coast in Group D.
Youssef En-Nesyri scored the game’s only goal in the first half after a clever pass from Nordin Amrabat.
Ivory Coast had gone close with just 38 seconds gone when Wolves’ Romain Saiss cleared a header from Aston Villa’s Jonathan Kodjia off the line.
Morocco end their group campaign against South Africa on Monday (17:00 BST), while Ivory Coast play Namibia.
Morocco could still be caught by both Ivory Coast and South Africa, but they are already assured of at least being one of the four best third-placed teams.
As well as scoring, En-Nesyri swept a shot into the side-netting and forced Sylvain Gbohouo into a terrific save down to his left after Amrabat dummied Hakim Ziyech’s low cross.
Ivory Coast, who left Crystal Palace talisman Wilfried Zaha on the bench, could have pulled level when Max Gradel was played through on goal, but Morocco goalkeeper Yassine Bounou was quickly off his line to smother the danger, before Pepe fired the loose ball into the side-netting.
From BBC Arabic’s Riham Eldeeb:
The points are all that matter and Morocco go into the final group game without any pressure now they have qualified for the knockout stages, but we still haven’t seen the perfect performance from them.
Ivory Coast offered nothing and the questions for them are around the player who didn’t take to the pitch. Why aren’t we seeing Zaha? Two attacking players were brought on before him and an injury meant he couldn’t come on. It was a big surprise not to see the Crystal Palace forward.
It’s a big win for Morocco manager Herve Renard against his former team – he certainly won the tactical battle here.
Photo Caption: Morocco celebrate Youssef En-Nesyri’s first-half winner in Cairo