Despite creating a host of chances and seeing more of the ball than their opponents, Algeria are knocked out, having lost their opening two games.
After a cagey opening, both sides started to create some chances. First, Islam Slimani shot wide after good play from Sofiane Feghouli, before Emmanuel Adebayor headed wide for Togo following a nice move down the left.
As the half wore on, it was Algeria who started to dominate; Feghouli was the man pulling the strings, as first Djamel Nesbah received a debatable offside call and then Kossi Agassa made a good double-save for Togo.
It was Togo who took the lead though. A rare counter-attack released Adebayor and the Tottenham Hotspur forward controlled the ball before slotting it into the net.
Algeria continued in the ascendancy thereafter but could not find an equaliser before half-time.
Feghouli went down in the box just after the break, but the referee waved away Algeria's penalty appeals. They responded by doubling their efforts, and only some excellent last-ditch defending from Togo denied them.
Algeria's dominance continued throughout the second half, Feghouli had another penalty appeal turned down, before the same player found Slimani in the box again, but again the striker failed to take the chance.
Togo did manage a late breakaway and would have wrapped up the win had Sapol Mani been able to find Adebayor in the box.
It didn't matter in the end, as after some drama with a broken goal-frame and a lengthy delay, Togo scored again when substitute Dove Wome broke from the halfway line and scored.
Algeria do have one more game to play but cannot go through virtue of the head-to-head rule. Togo will face Tunisia in their next match.