Riyad Mahrez scored twice in Algeria's 4-1 victory over Togo on Sunday to seal his country's place at the 2019 Africa Cup of Nations.
Gambia's 3-1 win over Benin on Saturday meant victory for Algeria in Lome would guarantee them a top-two place in Group D, and Mahrez ensured they achieved that.
The Manchester City winger opened the scoring in the 13th minute with a superb volleyed lob before doubling his tally on the half-hour with a rasping drive - that coming soon after Youcef Attal had made it 2-0.
Togo were able to pull a goal back but Algeria sealed the win they needed thanks to Baghdad Bounedjah's stoppage-time strike and the Desert Foxes will hope to end a 29-year wait for AFCON glory when the finals get under way next June.
They will be joined in Cameroon by the Ivory Coast after they secured a 1-1 with already-qualified Guinea, Fulham midfielder Jean Michael Seri scoring the decisive goal that sees the Elephants progress from Group H.