Hakim Ziyech scored twice as Morocco defeated Cameroon 2-0 in Casablanca on Friday to take a giant step towards next year's Africa Cup of Nations.
Karl Toko Ekambi was sent off in the second half for the Indomitable Lions, who fell to the first defeat of Clarence Seedorf's brief tenure and their first ever loss to Morocco.
The win moves Morocco up to top spot in Group B, on 10 points, and they'll progress if they avoid a defeat by a three-goal margin in their final qualifier against Malawi in March 2019.
They could also secure their ticket for the biennial showpiece if the Flames fail to win away at Comoros on Saturday.
Morocco were much improved after the break following a turgid first half, with substitute Sofiane Boufal adding vitality and invention to Herve Renard's side following his half-time entrance.
He was brought down for a penalty which Ziyech dispatched in the 54th minute, before the Ajax playmaker then added a second with a 20-yard effort 12 minutes later.
Boufal went close to completing his triumphant return to the national team in style when he sent an effort wide in the 72nd minute, while Toko Ekambi was dismissed after being shown a second yellow card, for diving, in the 79th minute.
While Cameroon have qualified automatically for the 2019 AFCON as hosts, the Indomitable Lions are still taking part in the qualifying campaign in Group B.
They will aim to bounce back in an international friendly against Brazil in London on November 20.