There seemed little need for the officials to get involved when Salah went down after being touched on the face during a footrace with Khuliso Mudau, but Ndabihawenimana awarded the decisive penalty following a Video Assistant Referee (VAR) review and pitchside monitor check on a flailing arm from the dismayed right-back.

The protesting Foster joined Mudau in the book before Salah chipped in his Panenka finish to move four goals shy of head coach Hossam Hassan’s record 69 goals for Egypt, scoring his second of the finals following his 91st-minute strike in Monday’s comeback victory over Zimbabwe.

Both of Hany’s cautions seemed careless, clearly pulling back Tshepang Moremi despite little apparent danger and treading on Teboho Mokoena’s ankle in a clumsy challenge on the touchline.

Moremi’s half-time introduction against Angola helped transform South Africa’s performance in their opener, finding the net with an effort which was narrowly ruled out for offside before assisting Foster’s curling winner.

The Orlando Pirates winger started this game but could not muster another telling intervention during a tight first half, with Manchester City’s Omar Marmoush swinging a free-kick narrowly wide for Egypt after being brought down just outside the box.

Salah’s goal and Hany’s dismissal set up a second half full of frayed nerves for the North Africans, who sent on Emam Ashour for Marmoush in a defensive change at the interval, and frustration for South Africa, who could have had a late penalty following a lengthy VAR check over Yasser Ibrahim’s handball.

Having initially awarded a free-kick outside the penalty area, Ndabihawenimana was invited to check his decision on the monitor. While the referee agreed the contact was actually inside the box, he decided Ibrahim’s arm was in a natural position to break his fall as he slid in to make his block.

South Africa’s substitutes were off their feet and holding their heads in their hands several more times during the closing stages, when Ngezana should have made a firmer connection with his headed opportunity from a corner and Evidence Makgopa and Modiba sent efforts wide.

The result means Egypt are now favourites to top Group B while South Africa must avoid a slip-up against neighbours Zimbabwe to make sure of their place in the second round.