While the Atlas Lions lost out to Spain in Monday's semi-finals, the Pharaohs were beaten by hosts France after extra time - now both seek an historic first football medal for their nation.
Match preview
After topping Group B ahead of Argentina before thumping the United States in the quarter-finals, Morocco went into their semi-final clash with Spain full of confidence, as they sought a place in the gold-medal match.
However, their remarkable run ended at Stade Velodrome, where the Atlas Lions saw their hopes dashed by a second-half Spanish fightback: after main marksman Soufiane Rahimi scored from the spot, they let that lead slip to lose 2-1.
Fermin Lopez equalised in the 66th minute, before the Barcelona star set up Juanlu Sanchez for Spain's second just as extra time loomed, so the Moroccan squad's bid to repeat the senior side's World Cup heroics against La Roja ultimately fell short.
While Walid Regragui's men finished fourth in Qatar, losing the third-place playoff, Tarik Sektioui's young charges now hope to triumph in the Olympics' equivalent, with Thursday's consolation game determining who takes home the bronze medal.
Winners of last year's Under-23 Africa Cup of Nations, where they beat Egypt to take the trophy on home turf, a high-stakes re-match with the Pharaohs now awaits.
Finding a late equaliser before knocking Paraguay out in the quarter-finals kept Egypt's dreams of a first Olympic Games football medal alive and set up semi-final contest with the tournament hosts on Monday.
Despite leading with 10 minutes to go, though, Jean-Philippe Mateta scored twice to deny the Pharaohs a place in the final, as France fought back to win 3-1 after extra time in Lyon.
After levelling the game following Mahmoud Saber's close-range opener, the Crystal Palace striker headed Les Bleus in front once Omar Fayed had been sent off for a second bookable offence; Michael Olise then added some gloss to the final scoreline.
Nonetheless, Rogerio Micale's side have still beaten Egypt's previous best performances at the Olympics: quarter-final exits at both London 2012 and in Tokyo three years ago.
Having beaten Spain en route to topping Group C and then pushed France so close in the semis, they will now fancy their chances of gaining revenge on Morocco, who deposed them as Under-23 AFCON champions last summer.
Morocco Olympic Games Men's Football form:
W
L
W
W
L
Egypt Olympic Games Men's Football form:
D
W
W
W
L
Team News
After key midfielder Bilal El Khannous missed Morocco's semi-final defeat due to suspension, he will be back in the fold for Thursday's bronze-medal match, featuring behind a potent attack spearheaded by Soufiane Rahimi.
The Al-Ain striker, who has racked up six goals from five games so far, is supported by former Barcelona wingers Ilias Akhomach and Abde Ezzalzouli in the final third.
Captain of the Atlas Lions this summer, right-back Achraf Hakimi played a major part in Morocco's memorable fourth-place finish at Qatar 2022, and the Paris Saint-Germain star will now aim to go one better in France.
Egypt, meanwhile, must make a change in defence, as they will be without Omar Fayed, who is suspended following a red card against France: the centre-back will particularly regret his first booking, for protesting against a penalty that was ultimately not awarded after the VAR's intervention.
Once again, Osama Faisal and Zizo should join Ibrahim Adel in an attacking triumvirate: the latter has scored three goals in five games, including a brace against Spain and a late equaliser in the quarter-finals - he then converted the winning spot kick in a penalty shootout.
The Pharaohs generally line up in a 4-1-2-3 formation, with 32-year-old captain Mohamed Elneny - one of only two overage players selected by Brazilian boss Rogerio Micale - shielding the back four.
Morocco possible starting lineup:
Mohamedi; Hakimi, Boukamir, El Azzouzi, El Ouahdi; Targhalline, Richardson; Akhomach, El Khannouss, Ezzalzouli; Rahimi
Egypt possible starting lineup:
Alaa; Saber, Tarek, Abdelmeguid, El-Debes; Elneny; Shehata, Kouka; Zizo, Faisal, Adel
We say: Morocco 2-1 Egypt (after extra time)
Two well-matched teams meet with an historic bronze medal at stake, which may temper their attacking instincts just a little. Nonetheless, both sides have some skilful players in the final third, and an absorbing contest should just go the way of rising football force Morocco.