Bafana Bafana's Africa Cup of Nations dreams came to a crashing end on Monday evening, after they lost their third and last group match 1-0 to Morocco in Cairo. 

Moubarak Boussoufa's lone goal deep into injury time was enough to give the North African side three wins out of three, at the same time condemn the South African side to a group stage exit. 

The result, coupled with Ivory Coast's win against Namibia saw Stuart Baxter's boys finish third in the group with three points, behind the West African and Northern sides. 

Namibia finished bottom of the group with no point, having lost the opening two matches; identical 1-0 losses to Ivory Coast and Morocco. 

Cagey affair

It was a cagey affair as both teams struggled to carve out real chances in the firsts half, with the main battle lying in midfield as Tau and Belhanda battled out in most cases.

Morocco came close to opening the scores in the 19th minute as Younes Belhanda volleyed the ball on the edge of the box after a rebound, but it flew just over the bar as Ronwen Williams scrambled to cover his goal. 

Bafana Bafana too got a chance of their own on the 34th minute, which fell to Zau, whose shot whizzed past the post. 

Morocco thought they had gotten a penalty two minutes later, but the referee waved play on as both sides went to the break tied at 0-0. 

The second half kicked off with South Africa on the front foot and should have gotten an opener only for Thamsanqa Mkhize to drag his shot just wide four minutes after the restart. 

Youssef En Nesyri came the closest to finding the net after his ferocious shot beat the keeper only for it to hit the right post and go out for a goal-kick.

However, with the match headed for a drab draw, Moubarak Boussoufa popped up with the winner in the 90th minute, volleying home after a poor clearance from a free kick on the left win. 

Ivory Coast vs Namibia

In the other group match, Ivory Coast beat Namibia 4-1 to advance to the next round as Group D runners up. 

The Elephants went into the match knowing their fate was in their hands, as only victory would assure them a spot in the next round. 

Max Gradel gave The Elephants the lead in the 39th minute, before Serey Die grabbed the second on the 58th minute. 

Crystal Palace's Wilfried Zaha scored the third with six minutes remaining, and Maxwel Cornet iced the cake with the fourth on the 91st minute. 

The victory took them to six points, one behind leaders Morocco

Follow Kenya vs Senegal live on Futaa!

Follow all of the action live on Futaa and download our AFCON 2019 app on Google Play for daily AFCON news, stats, betting tips, live scores and more at your fingertips.

Read more: Harambee Stars vs Senegal: The key stats & key stars to watch out for tonight