Islam Slimani scored twice but Algeria’s Africa Cup of Nations hopes were ended after a 2-2 draw with Senegal in Franceville on Monday.
The Leicester City striker put Algeria ahead on two occasions but each time Senegal equalised, first through Papa Diop and then courtesy of Moussa Sow as they finished Group B in first place with seven points.
Like the Senegalese, Algeria were one of the pre-tournament favourites but they go out without winning a game, with Tunisia finishing in second place after their 4-2 victory against Zimbabwe in Libreville.
It is Tunisia who progress to a quarterfinal against Burkina Faso in the Gabonese capital at the weekend, while Senegal already knew they would be playing Cameroon in Franceville.
“I had warned that Senegal were one of the big favourites and we showed that we could respond in difficult circumstances, which is important for the future,” said Algeria coach Georges Leekens.
“Overall it is a disappointment, but we need to use this to grow in the future,” he added as Algeria are left to focus on trying to qualify for the 2018 World Cup in Russia.
“I am still sure of what I have to do. It was not a gift for me to come here but we will make it to Russia. I think my players showed they could react.”
With top spot already secured, Senegal coach Aliou Cisse changed his entire team with the exception of skipper Kara Mbodj for their final group outing.
Algeria had to win and hope for a favour from Zimbabwe in the night’s other game, but there was to be no miracle.
They took an early lead when Sofiane Hanni’s ball to the back post was turned into the roof of the net by Slimani, and African Footballer of the Year Riyad Mahrez was denied by the goalkeeper as he threatened to increase their advantage.
Senegal then drew level two minutes before the interval when Aissa Mandi headed the ball out only as far as midfielder Diop, who volleyed home first time from the edge of the area.
Algeria responded by seizing the lead for a second time eight minutes into the second half with a goal made in Leicester.
Mahrez lifted the ball up to the back post where Slimani controlled before slicing a volley towards goal, his effort just crossing the line despite the best attempts of Cheikh Ndoye to clear off the bar.
But the score in the other game had left Algeria with too much to do and Senegal equalised again within a minute anyway, Sow with a crisp first-time finish from 22 yards after the ball broke to him at the edge of the box.
TUNISIA CRUSH ZIMBABWE
Tunisia became the first team to score four goals at the 2017 Africa Cup of Nations as they beat Zimbabwe 4-2 in Libreville to seal a quarterfinal place.
The Carthage Eagles, who led 4-1 at half-time, finished Group B runners-up behind Senegal and play Burkina Faso at the same stadium Saturday.
Naim Sliti, Youssef Msakni, Taha Yassine Khenissi and Wahbi Khazri scored for Tunisia and Knowledge Musona and substitute Tendai Ndoro for Zimbabwe.
Senegal topped the Group B standings with seven points followed by Tunisia with six, Algeria two and Zimbabwe one.
Tunisia began the match at the Stade de l’Amitie knowing a draw would suffice to clinch second place and reach the knockout phase.
But there was never a hint from the north Africans that they were playing for a point and Sliti scored via a deflected shot on nine minutes.
Sliti set up the second for Msakni on 22 minutes and Khenissi beat goalkeeper Tatenda Mkuruva at his near post for the third Tunisian goal on 36 minutes.
A superb Musona goal three minutes before half-time offered Zimbabwe a glimmer of hope only for Khazri to convert a 45th-minute penalty.
The tempo inevitably slowed after half-time with both teams playing for the third time in nine days and Ndoro scored the lone second-half goal.
“We regained possession well during the first half and created scoring chances,” said Poland-born Tunisia coach Henryk Kasperczak.
“It was a satisfactory performance and I congratulate my players. Now we face Burkina Faso, a quality team with good technique and attacking combinations.”
Zimbabwe coach Callisto Pasuwa said: “We lost the match in the early stages due to a lack of concentration.
“I think we have potential, but must prepare better. A lesson from this tournament is that the players have to remain focused throughout games.”