Soufiane Rahimi scored twice for African Nations Championship title-holders Morocco as they came from behind to trounce Uganda 5-2 in Douala Tuesday and reach the quarter-finals.
The defending champions were joined in the knockout stage by Rwanda, who trailed Togo twice before Jacques Tuyisenge and Ernest Sugira scored within six minutes to create a 3-2 victory in Limbe.
Morocco, who hope to become the first back-to-back winners of the competition for home-based players, topped Group C with seven points, Rwanda had five, Togo three and Uganda one.
In the quarter-finals, Morocco play the Group D runners-up and Rwanda the Group D winners, and their rivals will be known Wednesday after Guinea face Tanzania and Zambia meet out-of-contention Namibia.
Record two-time champions the Democratic Republic of Congo confront host nation Cameroon and Mali tackle Congo Brazzaville in the other last-eight pairings.
One Nations Championship record was equalled and another two broken as Morocco flexed their muscles to overwhelm Uganda at Stade Reunification in the Cameroon economic capital.
Morocco became only the second nation after Tunisia in 2016, against Niger, to score five goals in a match at the tournament.
The five goals lifted the overall Moroccan total to 33 from 16 matches, bettering the 31 of DR Congo.
And, as if being hammered and eliminated was not bad enough, Uganda have conceded 24 goals during five appearances in the Nations Championship, more than any other country.
A night that ended so badly for the Ugandans began promisingly with an Ibrahim Orit goal on 25 minutes not only giving them the lead, but also lifting them to second in the table, ahead of Morocco.
That situation remained until the fourth minute of stoppage time at the end of the first half when Morocco captain Ayoub el Kaabi converted a penalty awarded when Ugandan Mustafa Mujuzi handled.
Rahimi stole the second-half show, scoring either side of a goal from Hamza el Moussaoui, to give the north Africans a 4-1 lead.
The goal deluge continued in the closing minutes as Saidi Kyeyune pulled one back for Uganda, whose goalkeeper, Charles Lukwago, then turned an Abdelilah Hafidi shot into his own net.
In a Limbe thriller, Yendoutie Nano gave the Togolese a lead that was cancelled by Olivier Niyonzima in the final minute of the first half.
Bilal Akoro put Togo, the only nation among the 16 in Cameroon competing at the Nations Championship for the first time, ahead a second time before Rwanda struck twice to finish runners-up.