Algeria progressed to the last 16 at the Africa Cup of Nations on Thursday night following a rugged 1-0 victory over Senegal. Their success over Africa's highest ranked team moved them onto six points and they will guarantee top spot from Group C with a draw against Tanzania on 1 July.
Mohamed Youcef Belali got Algeria's winner four minutes into the second half at the 30 June Stadium in Cairo. His strike followed a rapid counterattack down Algeria's right flank.
Sofiane Feghouli, guilty of squandering a good chance seconds earlier, flew down the wing and cut the ball back to the edge of the Senegal penalty area. The untracked Belali took a touch and thrashed the ball to right of Senegal goalkeeper Edouard Mendy.
"They are not just a good team, they are the best team in Africa," said Algeria coach Djamel Belmadi. "We played well. We defended properly and created some good chances. Of course, they had some opportunities but I think we deserved to win this game."
Despite the setback, Senegal remain second in Group C.
"We have 23 good players so we have to keep on going," said Senegal defender Kalidou Koulibaly.
"We have to improve on this performance because we have a nice team and we know that we can do something good. I don't think we should have a problem showing how good we are. I think in the next game you'll see another side of Senegal."
In their final pool game, Aliou Cissé's men take on Kenya who twice came from behind to beat Tanzania 3-2 in a pulsating game at the 30 June Stadium.
Simon Msuwa fired Tanzania into the lead after six minutes. But that was spectacularly cancelled out by Michael Olunga's overhead kick in the 39th minute.
But before Kenya could revel in their parity, Tanzania retook the lead in the next minute through Mbwana Samata.
Johanna Omolo squared matters in the 62nd minute before Olunga drove home the winner 10 minutes from time.
"I'm really happy because it is the players who have written history for Kenyan football," said Kenya coach Sebastien Migne. "And now the whole country can dream of something fantastic. Kenyans can be proud because their football players have shown their qualities and their team spirit."
A first appearance in the knockout stages will be secured with a point against Senegal.
In Group B, Madagascar won the battle of the debutants to move into second place behind Nigeria.
Marco Ilaimaharitra got the winner against Burundi 14 minutes from time to give Madagascar a chance of reaching the last 16 and potentially topping the group when they face Nigeria on 30 June.