Morocco came from behind to beat Togo 3-1 and get their Africa Cup of Nations campaign back on track in Oyem.
After suffering a surprise defeat to DR Congo in their Group C opener, Herve Renard's men knew their campaign was in serious trouble when Mathieu Dossevi gave Togo a surprise lead.
But Morocco hit back with two first-half headers from Aziz Bouhaddouz and Romain Saiss, before substitute Youssef En-Nesyri sealed the victory late on.
Morocco move up to second in the group and now only need a draw in their last match against Ivory Coast to reach the quarter-finals.
Togo, meanwhile, are bottom on one point and face a massive task to progress to the last eight - they must beat leaders DR Congo by two goals.
It is only Morocco's third win in 15 AFCON games, while Togo have tasted victory in one of their last 12 in the competition.
Kodjo Fo-Doh Laba had already come close for Togo before they took the lead with a brilliant counter-attack inside five minutes.
Having broken from their own box, Claude Le Roy's men struck when Laba found Floyd Ayite, who in turn fed Dossevi to finish calmly into the far corner.
But Morocco responded emphatically, scoring with two headers in the space of seven minutes.
They levelled the match after 14 minutes, Faycal Fajr's corner completely missed by goalkeeper Kossi Agassa and headed in by Bouhaddouz from inside the six-yard box.
It was quickly two when Saiss headed home an inswinging free-kick from the impressive Fajr, whose deliveries were causing Togo problems.
A stretching Emmanuel Adebayor almost hit back for Togo when he raced on to Laba's flick-on and forced an excellent diving save from Munir.
But it could have been game over at the other end when Agassa completely misjudged Saiss' cross and Nabil Dirar missed the target with the goal gaping.
Adebayor headed over from Dossevi's cross as Togo looked for a route back into the game after the break.
But Morocco sealed victory through substitute En-Nesyri, the Malaga teenager collecting a pass from Karim El Ahmadi and firing in a left-footed shot from outside of the box which was too hard for Agassa to handle.
A late solo run from Ayite ended with him dragging a shot inches wide, Togo's hopes of salvaging a result ending with that chance.