Egypt advanced to the Africa Cup of Nations round of 16 after a thrilling Group B match in Abidjan ended in a 2-2 tie with Cape Verde.
Prior to goals in stoppage time in both games against Ghana and the Blue Sharks, Egypt was certain to finish third.
Mostafa Mohamed, a forward for the Pharaohs, appeared to have won it in the ninetieth minute.
But six minutes later, Cape Verde tied the score, and the Pharaohs won second place as Ghana let a 2-0 lead against Mozambique slip away in extra time.
The team of Rui Vitoria will play the second-place finisher in Group F on Sunday at 20:00 GMT in the round of 16.
Watched by an ailing Mohamed Salah, Egypt fell behind at the half after a clever finish by Benchimol. However, in the 50th minute, halftime substitute Trezeguet tied the score.
The Pharaohs, knowing that a win would guarantee them a spot in the second round, joyfully rejoiced when Mohamed’s long-range effort put them ahead 2-1 in extra time, with Ghana leading Mozambique.
Drama, however, ensued when match official Alhadi Mahamat was summoned by the Video Assistant Referee (VAR) to his pitchside monitor to determine whether Mohamed had used his hand or his chest to direct Trezeguet’s pass forward.
After a while, the Chadian official certified the goal, but Egypt nearly gave up when Bryan Teixeira scored from close range.
However, Ghana had somehow conspired to concede a 91st-minute penalty and a 94th-minute equalizer against Mozambique, which meant Egypt progressed to the knockout stages despite drawing all three group games in Ivory Coast.
Salah was forced off during last Thursday’s 2-2 draw with Ghana, so he was ruled out, but the attacker was in the grandstand for what turned out to be a nerve-wracking evening for the record seven-time continental winners.
In order to receive treatment for his leg injury, the 31-year-old will travel to Liverpool; nevertheless, agent Ramy Abbas Issa has expressed doubts about Salah’s ability to play even if Egypt advances to the final on February 11.
Despite controlling the first quarter, the Pharaohs were behind at the half. Trezeguet’s basket just seconds after the half ended summed up their newfound resolve.
The former Aston Villa player and Ahmed Hegazi played a beautiful one-two, and his left-footed volley had enough strength to pass between Vozinha’s legs.
Trezeguet was at the centre of Egypt’s greatest openings, forcing Vozinha to parry a curling effort and missing wide from range, so it was hardly surprising that he broke through the Cape Verde defence to set up Mohamed’s goal.
Before taking against the North Africans, Cape Verde had already won Group B, and a significantly transformed team proved their mettle by tying the score in the last seconds.
After Teixeira made it 2-2, many Pharaohs players collapsed to the ground, believing Ghana had won. However, the wait until the next restart benefited them, as they learned that a point was sufficient to advance.
Egypt finished second in both the 2017 and 2021 tournaments, and despite making it to the elimination rounds, they are still hopeful that Salah will return to win an Afcon for the first time since 2010.