Algeria crashed out of the Africa Cup of Nations as Mohamed Dellahi's first-half goal proved enough to earn Mauritania a shock 1-0 win in Group D – their first in the history of the tournament – and a ticket to the last 16.
Dellahi punished some lax defending in the 36th minute and – despite a second-half onslaught – two-time tournament winners Algeria could not find a response as they finished bottom of their group for a second consecutive AFCON, while Mauritania go forward as one of the best third-placed teams.
After two successive draws had left them in trouble, Algeria coach Djamel Belmadi dropped Riyad Mahrez to the bench as he tried to freshen up his side but it did not work as Mauritania proved stubborn opponents.
Algeria dominated possession and Adam Ounas tried to catch out Babacar Niasse, shaping to cross and hitting a vicious inswinging shot the goalkeeper did well to claw behind.
But Mauritania stunned Algeria late in the half. Anthony Mandrea pushed away a stinging shot from Souleymane Anne, but Algeria could not clear the resulting corner and when Omare Gassama's shot was blocked, the ball fell for Dellahi to fire in.
Mahrez came on at the break as Algeria tried to turn up the heat but Mauritania remained a threat, and Aboubakary Koita wriggled his way past three defenders in the box before sending an off-balance shot over.
At the other end, Niasse came tearing off his line to cut out Ramiz Zerrouki’s long ball forward, but needed Ibrahima Keita to scramble back and block Youcef Belaili’s shot at his unguarded goal.
Algeria were looking desperate but it was Mauritania who had the late chances to score, with Lamine Ba hitting the crossbar before Guessouma Fofana was denied by the goalkeeper.
Eleven minutes were added on and Algeria went agonisingly close again, with Baghdad Bounedjah poking the ball inches wide after Aissa Mandi’s shot was blocked by Niasse, but it was Mauritania’s night.
Angola finished top of the group as striker Mabululu's first-half header and a stoppage-time finish from Zini secured a 2-0 victory over Burkina Faso.
Angola finished on seven points with Burkina Faso second on four points.
Mabululu’s 36th-minute header at the Charles Konan Banny Stadium came as Burkina Faso’s Bertrand Traore failed to clear a free-kick from Angola captain Fredy and the striker headed home at the near post for his second goal of the tournament.
He had also scored in their opening match, which they drew 1-1 with Algeria.
Substitute Zini scored as he reacted quickest after Jeremie Bela’s effort at the start of stoppage time had been parried by Burkina goalkeeper Herve Koffi.
Burkina Faso, with Bournemouth’s Dango Ouattara leading their efforts on his return to the team from injury, looked the better of the two sides in a languid affair but they were not able to break down the stubborn Angola defence and had few chances.
Isaa Kabore, flying down the right flank, had a good chance after 26 minutes but put his effort wide while Traore’s 70th-minute shot was blocked.
Djibril Ouattara went close from a corner in stoppage time as Burkina kept up the pressure but then Zini doubled Angola's advantage.
It was only the second time in nine finals appearances that Angola had topped their opening round group. The other was when they hosted the tournament in 2010 but were then immediately eliminated in the knockout stage.

Cameroon fought back with two goals in the closing stages to edge The Gambia 3-2 in a thrilling encounter and advance from Group C after being minutes from elimination.
Defender Christopher Wooh netted a dramatic stoppage-time winner to put the Indomitable Lions second in the group behind Senegal. They finished ahead of Guinea on goals scored.
Cameroon had to claw their way back in a game of relentless attack and end-to-end action to keep alive their hopes after falling 2-1 behind with only five minutes left.
Wooh headed home a corner in a riveting fightback in the first minute of stoppage time as all five goals came in an action-filled second half.
The Gambia had dominated the first-half exchanges despite being 80 places below their much vaunted opponents in the FIFA rankings but Cameroon came out strongly after the break with Georges-Kevin Nkoudou rattling the crossbar in the 50th minute and then setting up the opening goal six minutes later for Karl Toko Ekambi.
The 31-year-old Toko Ekambi was a member of the Cameroon side who won the Cup of Nations in 2017 and showed his experience to get his head to a long through ball.
But a sudden burst of attack from The Gambia had Cameroon's defence looking jittery and it was no surprise when Ablie Jallow equalised in the 72nd minute with a clever volley as he ghosted late into the box.
Alieu Fadera might have put Gambia ahead soon after but his shot clipped the outside of the post. But they swept into the lead in the 85th minute through substitute Ebrima Colley, who hit a powerful shot after a clever one-two pass with Assan Ceesay.
Cameroon needed to score twice in the remaining time and were level when James Gomez steered the ball into his own net with his outstretched leg as he attempted to clear.
Wooh then grabbed the winner in a stunning conclusion to set up a last-16 meeting with Nigeria in Abidjan on Saturday.
Cameroon dropped Andre Onana, after their 3-1 defeat to Senegal in their previous match, putting Fabrice Ondoa back in goal and while he looked far from assured initially he made several key stops to keep The Gambia at bay.
Coach Tom Saintfiet quit minutes after his side's elimination. The 50-year-old Belgian said his contract was running out in August but he would be leaving immediately.
Abdoulaye Seck and Iliman Ndiaye scored second-half goals as defending champions Senegal beat Guinea 2-0 in Yamoussoukro to make it three wins from three as both teams advanced to the last-16.
In contrast to what we have seen so far in the Ivory Coast, it was a game of few clear-cut chances, with neither side overly committed to attack. It was no surprise when Seck's opener came from a set-piece before Ndiaye provided a neat finish.
Senegal top the pool with nine points, followed by Cameroon on four as they edged Guinea on goals scored. The latter will also advance as one of the best third-placed teams.
Senegal, who have been finalists in the last two editions and won in 2021, had coach Aliou Cisse back in the dugout after he spent the night in hospital with an infection following their victory over Cameroon in their previous match.
Senegal's goals came from their only two efforts on target, while Guinea had only one, a late effort that forced a good save from goalkeeper Edouard Mendy.
Cisse will be delighted his side put up another stout defensive display as they conceded once in the pool stages, scoring eight goals themselves.
Sadio Mane had an off day but had an excellent chance to break the deadlock just before the hour-mark as he raced clear on goal, rounded Guinea keeper Ibrahim Kone but skewed his shot at an empty net horribly wide.
It was a goal the 31-year-old would expect to score and there was a look of disbelief on his face that he couldn't find the back of the net.
Senegal did not have to wait much longer for the opener though as Seck stole a march on the Guinea defence from a Krepin Diatta free kick and powerfully headed into the net on 61 minutes.
Mane thought he had a second in the final 10 minutes, but he was well offside and the goal was ruled out, before substitute Ndiaye found a yard of space in the box and coolly doubled the Senegal advantage.