Morocco got their African Under-23 Championship campaign off to a perfect start when beating Nigeria 1-0 in Tangiers on Saturday.
The home side won the game thanks to a penalty converted by Abdelaziz Barrada.
Neither side really created any chances in the opening exchanges but Morocco dominated play.
Barrada opened the scoring from the penalty spot on 25 minutes after Nigeria's Emmanuel Anyanwu was judged to have fouled Yacine Qasmi in the box.
Nigeria were limited to long range efforts and none of them really troubled Yassine El Kharroubi in the Morocco goal.
Morocco should have doubled their lead 10 minutes into the second half but Soufiane Bidaoui somehow shot wide from six yards out with an open goal in front of him.
In the 72nd minute Youness Mokhtar raced clear of the Nigeria defence and appeared to shoot wide although the Moroccans claim it was blocked and claimed a corner.
With six minutes left to play Moroccan captain Driss Fettouhi shot from outside the area but his fierce drive went just wide of the target.
Nigeria, who struggled to string their passes together are aware that they must improve their game if they are to beat Senegal in their next match on Tuesday.
"Yes we didn't play well but we have seen the areas where we made mistakes and we will try to correct them," Nigeria assistant coach Stanley Eguma said.
"Nigerians should not lose hope but continue to believe in us as I know we will do well against Senegal in our next game," he said.
GROUP B FIXTURES, Marrakesh
- 27 Nov: Egypt v Gabon
- 27 Nov: S Africa v Ivory Coast
- 30 Nov: Gabon v South Africa
- 30 Nov: Ivory Coast v Egypt
- 03 Dec: Egypt v South Africa
- 03 Dec: Gabon v Ivory Coast (being played in Tangiers)
In the second Group A game
1-0 to make it a good day for North Africa.
Algeria were the first to threaten when a long range shot almost squirmed under the Senegal keeper, who grabbed it at the second time of asking.
A minute later Senegal's Stephane Badji's attempt from outside the area was punched up in the air by the Algeria keeper and his defence eventually scrambled the ball clear.
The first clear chance was in the 16th minute when Mohamed Chalali, who plays for Aberdeen in Scotland, headed against the bar.
Chalali had another chance two minutes later as Algeria created a three against two situation. This time his shot was saved by Ousmane Mane in the Senegal goal.
The same player had another chance in the 32nd minute as he chased a long high ball that bounced over the advancing Senegal keeper. Then under pressure from a defender, his diving header went wide.
Senegal's best chance came on the stroke of half-time with Abdoulaye Sane breaking into the box. He was prevented from getting a shot away by the Algerian keeper and a defender and got the ball back to Badji, who shot wide from the edge of the area.
Senegal started the second-half better with Sane shooting wide soon after the break.
Five minutes later Chalali was through again but instead of trying to shoot past the advancing keeper he slid it wide for a team-mate only for a Senegal defender to step in and clear behind from a corner.
Just after the hour mark, Algeria's Farid Daoud was put through on goal, but his shot was easily saved by Mane.
Algeria scored in the 78th minute through substitute Mehdi Benaldjia, who put the ball under the keeper and into the net.
He then picked up a yellow card for taking his shirt off in celebration and he then got a second booking in added time for complaining to the referee for not being able to get back on the pitch after an injury.
The two winning sides Morocco and Algeria play each other on Tuesday while on the same day Nigeria play Senegal.
As well as the top three sides going to the Games in London, the fourth-placed side faces a play-off against an Asian side for another spot at the Olympics.