Title-holders Ivory Coast were dumped out of the Africa Cup of Nations on Tuesday after a superb Rachid Alioui goal gave Herve Renard–coached Morocco a 1-0 win in Gabon.
Clinching a quarter-finals place was particularly sweet for Frenchman Renard, the coach of the Ivorians when they won the biennial tournament two years ago.
The blond, bronzed 48-year-old, wearing his lucky white shirt, hopes to become the first coach to win three Cup of Nations titles with three different countries.
He guided outsiders Zambia to glory in 2012 and repeated the feat with perennial underachievers Ivory Coast three years later.
The winning goal came on 64 minutes from France-based Alioui and set up a last-eight showdown against the Group D winners in Port-Gentil on Sunday.
Democratic Republic of Congo beat Togo 3-1 in the other Group C match to top the standings with seven points followed by Morocco (six), Ivory Coast (two) and Togo (one).
As the match kicked off twice champions Ivory Coast knew they had to win while a draw would suffice for Morocco, whose only title came 41 years ago.
The Ivorian Elephants and the Moroccan Atlas Lions were renewing a long rivalry with the last episode a 0-0 World Cup qualifying draw in Marrakech two months ago.