Argentina thought they had escaped from the Group B match in Saint-Etienne with a 2-2 draw when Cristian Medina scored in the 16th minute of added time.
But as their players celebrated, projectiles including bottles and plastic cups rained down from the stands and several spectators entered the pitch, with the referee promptly blowing the whistle.
The teams left the playing area, but the referee had not blown for full-time and the outcome of the match was completely unclear until the sides finally reappeared two hours later to play out three more minutes in a stadium by now emptied of spectators.
Medina's goal was eventually disallowed for offside following a VAR review, and Morocco held on to claim all three points.
![Cristian Medina of Argentina celebrates scoring their second goal with teammates Cristian Medina of Argentina celebrates scoring their second goal with teammates](https://livesport-ott-images.ssl.cdn.cra.cz/r900xfq60/36a6bb3f-6a0e-4b52-b755-d1136089f1ed.jpg)
It was an undignified start to the sporting action at the Paris Games, and a bad day all around for Argentina, whose players were booed as they emerged onto the pitch and during the national anthem by the crowd, most of whom were supporting Morocco.
That welcome came after Argentina players were filmed singing racist chants following their victory in the recent Copa America.
"It is a circus," complained Argentina coach Javier Mascherano.
"At no point did they tell us our goal was not valid... this would not even happen in a neighbourhood tournament. It's pathetic.
"Beyond the Olympic spirit, the organisation needs to be up to standard. At the moment it is not, unfortunately."
![A pitch invader is detained by stewards during the match A pitch invader is detained by stewards during the match](https://livesport-ott-images.ssl.cdn.cra.cz/r900xfq60/dff60267-209e-4cd0-bd83-702dd59e2e28.jpg)
Argentina are looking to win men's football gold for the third time after success in 2004 and 2008, but Mascherano's side trailed 2-0 following a brace by Soufiane Rahimi.
Morocco captain Achraf Hakimi, the Paris Saint-Germain full-back, set up Rahimi for the opener at the end of a fine move in first-half stoppage time.
The reigning African Under-23 champions doubled their lead six minutes into the second half from the penalty spot, UAE-based forward Rahimi stroking in the spot-kick after Ilias Akhomach was brought down.
Mascherano, who starred in the teams that won gold in Athens and Beijing, had at one point hoped to persuade Lionel Messi to feature among the three permitted overage players in his squad otherwise limited to those under 23.
Messi opted not to come to the Paris Games, and the biggest names in their side here were Manchester City striker Julian Alvarez and captain Nicolas Otamendi, the Benfica defender.
Giuliano Simeone, son of former Argentina star Diego, came off the bench to pull one back midway through the second half.
Medina then thought he had saved a point in the 106th minute as he nodded in after Otamendi and Bruno Amione both hit the woodwork in a frantic few seconds of action, only for Argentina to be denied.
Argentina's next game will be in Lyon on Saturday against Iraq, who came from behind to beat Ukraine 2-1 in their opener.