Algeria were one of the pre-tournament favourites but they go out without winning a game.
PIC: Senegal's midfielder Mohamed Diame (R) challenges Algeria's midfielder Yacine Brahimi on Monday. (AFP)
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 quarter-final 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.