Algeria crashed out of the Africa Cup of Nations at the group stage after failing to win a single game in Gabon.
They were held to a 2-2 draw by Group B winners Senegal in a match they had to win to have any chance of avoiding an embarrassing early exit.
Islam Slimani scored both their goals, a two-yard volley and a scuffed effort that wrong-footed Algeria’s goalkeeper.
But Senegal twice equalised, Papakouly Diop and then Moussa Sow both firing in efforts from the edge of the area.
Algeria went into the tournament as one of the favourites for the trophy but leave with their reputation damaged by three underwhelming performances.
After being held to a shock draw by Zimbabwe in their opener and then beaten by neighbours Tunisia, who booked their quarter-finals with a 4-2 win over Zimbabwe on Monday, Algeria have had a tournament to forget.
Their misery was compounded at the last by the fact they were held by Senegal’s second-string side, which featured 10 changes from their last game.
Watch Slimani score for Algeria
Le but de Slimani pic.twitter.com/m8VzbA9GZp
— 213% Fennecs (@213_Fennecs) January 23, 2017
Senegal coach Aliou Cisse had taken the opportunity to rest his first-choice players given the Teranga Lions had already won the group ahead of their final fixture.
And Cisse will be pleased by the resilience of his reserves who fought back to hold their own against a full-strength Algeria and ensure Senegal ended the group stage unbeaten.
Algeria might have signed off with a win but Slimani missed a chance to grab his hat-trick and a modicum of consolation when he shot wide when clean though.
Senegal will play Cameroon in the quarter-finals on Saturday.
Elsewhere, Tunisia secured their place in the Africa Cup of Nations quarter-finals as Group B runners-up with an easy win over bottom team Zimbabwe.
Naim Sliti’s deflected shot put Tunisia ahead before Youssef Msakni and Taha Khenissi extended the lead.
Knowledge Musona grabbed one back but a Wahbi Khazri penalty restored Tunisia’s three-goal cushion by the break.
Tendai Ndoro prodded in a Zimbabwe counter, before Khenissi hit the post in a wasteful second half.
The 2004 champions go on to play Burkina Faso in Gabon’s capital Libreville on Saturday.
In the group’s other game, a much-changed Senegal, already qualified as group winners, drew 2-2 with Algeria, who finish third and are eliminated.
Senegal, runners-up in 2002, will play Group A runners-up Cameroon in the last eight.
Tunisia only needed a draw to progress to the knockout stage following their 2-1 victory over Algeria on Thursday.
And they were rarely stretched as Zimbabwe failed to conjure anything like the quality of their opening performance, a surprise 2-2 draw against the Algerians, much-fancied before the tournament started.