Morocco joined the ranks of surprise casualties in the Africa Cup of Nations (AFCON) as they suffered a 2-0 defeat to South Africa on Tuesday. Meanwhile, Mali secured a spot in the quarterfinals.
Bafana Bafana's Evidence Makgopa and Teboho Mokoena found the net in the second half, adding to Morocco's woes.
South Africa once again proved to be a formidable opponent for the Atlas Lions, with Achraf Hakimi missing a penalty.
Despite an impressive record since reaching the World Cup semifinals in Qatar two years ago, winning 11 out of 13 matches, Morocco's only two defeats in this period have come at the hands of South Africa.
The shock last-16 result in the muggy Ivory Coast coastal city of San-Pedro came after Mali overcame Burkina Faso 2-1 in Korhogo, with Lassine Sinayoko scoring what proved the key goal.
Morocco joins defending champions Senegal, Tunisia, Algeria, Cameroon and Burkina Faso as teams ranked among the top 10 in Africa heading home early.
On Saturday, South Africa will face Cape Verde in Yamoussoukro after hosts Ivory Coast and Mali clash in Bouake.
In the other quarterfinals, Victor Osimhen-inspired Nigeria face Angola, and the Democratic Republic of Congo meets Guinea on Friday.
South Africa, Ivory Coast, Nigeria, and DR Congo are former champions, while the other four title contenders are hoping to conquer Africa for the first time.
While Morocco, thanks to their World Cup heroics, were favored to eliminate South Africa, two factors suggested there was a chance of a shock.
South Africa had won two and drawn two of five previous Cup of Nations meetings with Morocco from 1998.
And despite being an African powerhouse for decades, Morocco has consistently flopped at the Cup of Nations since their lone triumph 48 years ago.
Coach Walid Regragui called the repeated failures an "African curse," and the former national team full-back saw clinical South Africa pull off a deserved victory.
Makgopa stayed just onside to fire Bafana in front on 57 minutes, and Morocco squandered a great late chance to equalize when Hakimi fired a penalty against the crossbar and over.
A foul on Mokoena by Manchester United midfielder Sofyan Amrabat led to a VAR review that ended with a straight red card as he was the last defender.
Set-piece specialist Mokoena fired the free kick past Yassine Bounou and high into the net at the near post.
Sinayoko scored his third goal at the Cup of Nations as Mali reached the quarterfinals for the first time since 2013 by defeating Burkina Faso 2-1 in Korhogo earlier on Tuesday.
An early Edmond Tapsoba goal got Mali off to a great start in the last-16 tie, and Sinayoko doubled the lead just after halftime.
Captain Bertrand Traore reduced arrears from a penalty for Burkina Faso, who had the ball in the net again only for Issoufou Dayo to be ruled offside.
Victory was a welcome change of fortune for Mali, who has had two first-round and two last-16 exits since finishing third in South Africa 11 years ago.
"It was a really tough match against a good side. We had to work extra hard, but I am glad we eventually got the result," said Sinayoko.
"We can celebrate this victory while keeping at the back of our minds that there is still a lot of work ahead."
The match in the northern Ivorian city kicked off in 36 degrees Celsius (97 Fahrenheit) heat, and Mali needed only 133 seconds to score the second-fastest goal in the tournament.
A powerful Amadou Haidara header off a cross rebounded off the post, struck the left foot of Tapsoba, and rebounded into the net for an own goal.
Watched by Confederation of African Football (CAF) president Patrice Motsepe from South Africa, the football rarely excited the almost-capacity 19,154 crowd until the half-hour mark.
Then, Sinayoko stung the fingers of goalkeeper Herve Koffi with a hard close-range shot that was parried.
Mali went two goals ahead two minutes into the second half as Sinayoko broke clear of Tapsoba and beat Koffi with an angled shot.
But the lead was halved at 57 minutes when Boubakar Kouyate handled a cross and Traore converted his third penalty of the tournament as Mali goalkeeper Djigui Diarra dived the wrong way.
Long-serving defender Dayo thought he had leveled in the final minute of regular time by heading a free-kick past Diarra but was ruled offside.