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.
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.
Join GhanaStar.com to receive daily email alerts of breaking news in Ghana. GhanaStar.com is your source for all Ghana News. Get the latest Ghana news, breaking news, sports, politics, entertainment and more about Ghana, Africa and beyond.