Morocco claimed a first Olympic medal at the eighth time of asking as they swept aside Egypt 6-0 at the Stade de la Beaujoire on Thursday.
Abde Ezzalzouli and Soufiane Rahimi impressed for the Atlas Lions, with their first half goals sending Tarik Sektioui's on their way to a podium finish at the Games.
Bilal El Khannouss, Rahimi, Akram Nakach and a stunning free-kick from captain Achraf Hakimi would add further gloss to an impressive display after the break.
Morocco got off to an excellent start through Ezzalzouli's curling effort from outside the box, as Rahimi added a second three minutes later with a powerful header.
The result was put beyond doubt when El Khannouss notched Morocco's third, with Rahimi netting his sixth goal of the tournament just after the hour mark.
Rahimi then turned provider to set up Nakach inside the area, with Hakimi rounding off a fine display in style with an exquisite dead ball effort from distance.
Data Debrief: Rahimi stars in Atlas Lions' landmark triumph
12 years after their last appearance at the Olympic Games in London, Morocco returned with a bang, ending an impressive campaign with a deserved bronze medal.
Rahimi, who plays his football in the UAE with Al Ain, has been arguably the standout player of the tournament and leads the race for the Golden Boot ahead of France's Jean-Philippe Mateta and Spain's Fermin Lopez.
Morocco outperformed their expected goals (xG) by 4.76, with Rahimi contributing 0.82 to their xG total (1.24), while also registering the most shots on target (two) and touches in the opposition box (seven).