DURBAN, South Africa: Hosts South Africa came perilously close to going out of the African Nations Cup Sunday before a late equalizer earned a 2-2 draw with Morocco and a place in the quarterfinals.
Defender Siyabonga Sangweni leveled four minutes from time as they joined massive underdogs Cape Verde Islands in the last eight.
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. Cape Verde beat Angola 2-1 in the other Group A match in Port Elizabeth Sunday.
It was a dramatic conclusion to the section and came as a great relief to South Africa who had gone behind in the 10th minute.
Issam al-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 al-Arabi in a one-on-one situation.
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 equalizer 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 substitute Zakarya Bergdich.
South Africa kept fighting and four minutes later Sangweni expertly bent the ball into the net.
The hosts now stay in Durban for their quarterfinal against the runners-up in Group B.