Durban — Host South Africa twice came from behind to draw with Morocco 2-2 on Sunday and advance to the quarterfinals after finishing top of Group A in the African Cup of Nations.
The result meant that Cape Verde also reached the quarterfinals in its first major tournament after beating Angola 2-1 in a game that took place simultaneously in Port Elizabeth. Morocco finished third in the group.
Goals from Issam El Adoua and substitute Abdelilah Hafdi appeared to have put Morocco through for the first time since 2004.
But on both occasions South Africa fought back, with May Mahlangu and Siyabonga Sangweni ensuring the hosts topped their group on goal difference.
South Africa would have become the first hosts in 10 editions of the tournament to miss out on the knockout stages if they had lost to Morocco who were eliminated after drawing all three matches.
South Africa went behind in the 10th minute when Issam El Adoua headed Morocco in front as the host nation made a feeble effort to clear a corner
South Africa could have gone 2-0 down a minute later when goalkeeper Itumeleng Khune saved from Chahir Belghazouani.
Khune made another important stop just before halftime when Kamel Chafni broke free and his effort was smothered by the keeper as he came charging outside the penalty area.
Keeper Khune then excelled again as he denied Youssef El Arabi in a one-on-one situation, and Morocco held a 1-0 lead at the half.
South Africa, who managed only one shot in the first half, played with more enterprise after the break with two free kicks from Thuso Phala testing Morocco goalkeeper Nadir Lamyaghri.
May Mahlangu lifted the 50,000 crowd at the Moses Mabhida Stadium when he curled in the equaliser from the edge of the area in the 71st minute.
Morocco went back on the attack, throwing players forward, and were rewarded with eight minutes to go when Abdelilah Hafid swept in a pass from fellow substitute Zakarya Bergdich.
South Africa kept fighting and four minutes later Sangweni found himself clear and he expertly bent the ball into the net to score the final 2-2 margin.
It was a dramatic conclusion to Group A play and came as a great relief to the hosts.
For Morocco it was a heart-breaking end to the 2013 Nations Cup, as they played hard and had the better of South Africa for most of the match.
The hosts now stay in Durban for their quarter-final against the runners-up in Group B who will be determined on Monday.
Cape Verde beat Angola 2-1 in the other Group A match in Port Elizabeth on Sunday, to also advance to the semi-final round.
Fox News/Associated Press and Reuters