Morocco beat Indonesia 3-1 in Surabaya to secure top spot in Group A – and leave the hosts facing elimination.
The result leaves Indonesia in third spot with two points – and they hold only very slim hopes of qualifying as one of the four best third-place teams.
Morocco hit the front from the penalty spot just before the half-hour, Anas Alaoui clinically converting after Mohamed Hamony was fouled in the area.
Abdelhamid Ait Boudlal soon put them 2-0 ahead, heading home from a corner delivery.
Indonesia regrouped and pulled a goal back before half-time, Nabil Asyura’s stunning fre-kick sending a feverish home crowd wild.
They pressed for a leveller in the early stages of the second half but were unable to break through a stubborn Morocco backline.
And the Atlas Cubs made the win and qualification safe when Hamony lashed home on 64 minutes.
Indonesia now require other results to go their way in Groups E and F to have any chance of reaching the knockout phase.