A late flurry of goals by Morocco saw them beat Uganda 3-1 to progress to the quarter-finals of the Chan tournament as Group B leaders in a match played at Cape Town Stadium on Monday evening.
Having seen their first half lead erased by Uganda early in the second half, Morocco gambled by throwing their three substitutes late in the second half and the gamble paid off when they scored two late goals to sink the brave Cranes.
End to end stuff characterised the beginning of this encounter as both teams searched for an early goal.
Morocco forced two corner kicks in the 4th minute but on both occasions did not trouble Ivan Ntege in goals for Ugandan Cranes.
There was very little to separate the two teams as action continued to swing from one end to the other earlier on.
But it was Morocco's intelligent play that paid off in the 29th minute when AbdelKbir El Ouadi took on the Cranes defence and his cross from the left was easily tapped home by Abdessamad Rafik to make it 1-0.
Uganda's reply was quick. They threw bodies into the Moroccans box but twice saw their valiant efforts cleared off the line.
In the 53rd minute, Uganda came close to equalising but Yunus Sentamu's header was saved by Nadir Lamyaghri.
The equaliser finally arrived in the 59th minute when Sentamu finished off a move he created from outside the box to make it 1-1.
Sensing danger, the Atlas Lions made a double substitution, bringing in Iajour Mouhssine for Brahim el Bahri and Zakaria Hadraf for Abdessamad Rafik midway through the second half.
Uganda's Ronald Francis Olaki's effort was then easily saved by Lamyaghri as the Cranes threatened to put the match to bed.
Morocco then threw in their last substitute Abdessamad El Mobaraky for Mohsine Moutaouali in the 73rd minute.
Soon after, Ntege made a superb save after a snap shot from Abdelkbir El Ouadi caught the Ugandans on the back foot.
It was a threat which the Cranes did not take hid of and a minute later were punished when substitute Mouhssine 's low shot from just outside the box beat Ntege hands down in the 77th minute.
Mouhssine could have completed a brace but his attempt after he broke free was well saved by Ntege in the 82nd minute.
Savio Kabugo could not believe his eyes in the dying minutes of the match when his piledrive went narrowly over the bar as reality of possible elimination started to dawn on the East Africans.
As Uganda threw every man upfront, they were eventually punished when Ouadi scored deep inside injury time to make it 3-1.